Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 14th, 2010, 04:36 PM
george.goodeluinas's Avatar
george.goodeluinas george.goodeluinas is offline
Junior Community Member
 
Join Date: Jan 2010
Location: Central PA
Posts: 11
Default OnJobStart data input

sometimes I need to compose simple letters with names, addresses and dates. The problem is that it's never today's date. Or any predictable date. The customer simply tells me the date when they give me the data file. The date is NOT in the data file. Is there a way using OnRecordStart to bring up a dialog box and ask for the date to use? I've tried using window.prompt("Enter Date ","") but have not been getting very far.

Thanks
George
Reply With Quote
  #2  
Old February 15th, 2010, 01:46 PM
rpaterick rpaterick is offline
Senior Contributor
 
Join Date: Mar 2009
Posts: 427
Default Re: OnJobStart data input

I just have this as a regular rule.

Code:
return FormatDate(Today(), "lm d, yyyy");
Returns: February 15, 2010
__________________
Windows 7 64BIT
Intel - I7 chip - 3.33Ghz - 6GB ram
8.0 Creator/8.0 Producer/CS5.5
Reply With Quote
  #3  
Old February 15th, 2010, 03:12 PM
george.goodeluinas's Avatar
george.goodeluinas george.goodeluinas is offline
Junior Community Member
 
Join Date: Jan 2010
Location: Central PA
Posts: 11
Default Re: OnJobStart data input

rpaterick,
Thanks for the reply, but that simply provides today's date. I never know what date goes on the letters till the customer tells me what date they want on the letters when they send the data file.

In a perfect world the program would ask me for the date when it starts to compose.

Thanks
George
__________________
Fusion Pro Desktop 6.2P1a
Windows 7 64 bit Home Premium
Acrobat 8 Pro Ver 8.2.0
Reply With Quote
  #4  
Old February 15th, 2010, 03:26 PM
rpaterick rpaterick is offline
Senior Contributor
 
Join Date: Mar 2009
Posts: 427
Default Re: OnJobStart data input

Quote:
Originally Posted by george.goodeluinas View Post
rpaterick,
Thanks for the reply, but that simply provides today's date. I never know what date goes on the letters till the customer tells me what date they want on the letters when they send the data file.

In a perfect world the program would ask me for the date when it starts to compose.

Thanks
George
ahh, gotcha. Yeah, I would think that would be stretching it a bit to have FusionPro prompt you to enter in the date prior to composing. It would be nice if the customer just put the date in the data file, back to the "perfect world."
__________________
Windows 7 64BIT
Intel - I7 chip - 3.33Ghz - 6GB ram
8.0 Creator/8.0 Producer/CS5.5
Reply With Quote
  #5  
Old February 16th, 2010, 08:47 AM
Doug Pershing's Avatar
Doug Pershing Doug Pershing is offline
Junior Community Member
 
Join Date: Aug 2008
Location: Phoenix, AZ
Posts: 37
Default Re: OnJobStart data input

Hi George,

Since the date is not "predictable" it is difficult to create some kind of automated function. We had to deal with this same issue and through talking with the customer we were able to determine exactly why the dates were the they they were. In turn we found a way to calculate them.

If there is actually no way to calculate them then somebody needs to enter them somewhere. There are a couple of options:

1. Simply open the rule editor and enter the date you want to use like this:
At the top of the JavaScript Globals
Code:
date = "03/15/2010"
Since this is plain text you could literally enter the date exactly as you want it to appear. Now in any rule simply add this to your result.

Code:
return "Static text before the date " + date + " with the rest of the text after the date."
2. Shift the burden to the customer for the date entry by formating a small Excel file containing the date. Name the Excel file DateMatrix. Give the customer the Excel file to edit. When they send you the new file save it as a csv file. For simplicities sake save this small csv file in the root directory with you FP file.

StartDate EndDate
January 01, 2010 February 01, 2010

Enter this in the JavaScript Globals:

Code:
 
//Set the Date Matrix to retrieve the customer values
//Since it is in the root directory no path is needed to locate the file.
DateMatrix = new ExternalDataFileEx("DateMatrix.csv", ",")
Enter this in the OnJobStart callback rule. This will load the value and set the variables once as the job begins.

Code:
 
//Set the date variables 
StartDate = DateMatrix.GetFieldValue(1,"StartDate");
EndDate = DateMatrix.GetFieldValue(1,"EndDate");
Then create a rule called Offer Dates and enter this:

Code:
 
//Use the date variables entered in OnJobStart
return "Start Date: " + StartDate + " -- End Date: " + EndDate
Then place the rule into a text box on your layout. Whatever is entered in the fields in the Date Matrix csv file will be placed in the layout. I have attached a small example file. I hope this helps.
DateTest.zip
Reply With Quote
  #6  
Old February 16th, 2010, 10:09 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,293
Default Re: OnJobStart data input

Remember that FusionPro Desktop is intended primarily as a design tool for building FusionPro jobs (templates), not really as an end publishing tool. While you can certainly compose your job in FP Desktop, the real power of FusionPro is in its batch (automated) composition capabilities. This batch capability is available in FusionPro Server and FusionPro Direct, in our Web-to-Print solution MarcomCentral, and in many other third-party Web-to-Print solutions which integrate FusionPro behind the scenes. In most of these environments, FusionPro Server is running as a batch process, often on a dedicated, remote server machine, with no GUI context for displaying a dialog to an end user at composition time.

Also, while FusionPro does leverage the standard JavaScript 1.5 library, which has its roots in the Netscape/Mozilla Firefox browser and was originally designed for client-side web page scripting, only the core language elements are integrated with FusionPro, and web-specific objects and functions such as window and alert which you might see in online examples of web-specific JavaScript code are not relevant to FusionPro rules. Your "input" in a FusionPro rule is (primarily) the data file, not a web form, and your "output" is, well, your output, not a web page. (However, in addition to returning things that go into text and graphic frames in your composed output, you can also use functions such as Print in FusionPro rules to write to your log file.)

So, if you want a context for an end user to be able to enter data in a text box of some kind, either in a desktop or a web application, you will need to create the app and integrate FusionPro Server.

In FP Desktop, you will have to manually change either a file from which FusionPro is reading data, or something hard-coded in the job (in a rule or text frame) before composing. Doug's solution is a good one.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #7  
Old February 16th, 2010, 10:20 AM
LesSjo LesSjo is offline
Web-to-Print
 
Join Date: Mar 2009
Location: Fargo, ND
Posts: 92
Default Re: OnJobStart data input

I agree with Dan. Doug's solution is a very good one, which I will probably incorporate in some of my work soon. (Thanks Doug!)

However, there is something that everyone may be missing that looks to me to be a very simple fix.
Quote:
The customer simply tells me the date when they give me the data file.
To me this implies that there will be one date for the entire job, and just hard-coding the date in the text editor would probably be the easiest solution.

Just my $0.02.
__________________
Lester Sjoblom
Knight Printing
FP Desktop 6.2P1a FP Designer 6.0P1e | Acrobat Pro 9.5.1 |
Mac OS 10.5.8 2.8 GHz Intel Core 2 Duo 4 GB 800 MHz DDR2 SDRAM
Reply With Quote
  #8  
Old February 17th, 2010, 05:28 AM
DSweet's Avatar
DSweet DSweet is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Oberlin, Ohio
Posts: 237
Default Re: OnJobStart data input

George,

I have a sort-of-work-around that you can try to use. Why not code the date in a text file that can be read in and assign that date at the very beginning of composition? Try this....

1) Create a text file called "dateFile.txt" and store it in the same location as the template you are running. In this file give it a record header of "projDate" and then on the next line place whatever date your client wishes to have appear on this run of the letter.

2) In the template itself encode these two rules...

as an OnJobStart rule...
assignDate = new ExternalDataFileEx("dateFile.txt", "\t");
projectDate = assignDate.GetFieldValue(1, "projDate");

then as a regular text rule...
return projectDate

3) You can format the date however you wish within step 2 and use it wherever you wish then in the template by referring to the text-rule you assigned in step 2.

By doing this you do not need to alter the template in anyway in order to change the value of "projectDate". It will be assigned whatever value that you place in the text file "dateFile.txt" which can be changed over and over again prior to the start of a composition. And it will be read in and assigned anew everytime the project is run.

Hopefully this is a bit more than just 2 cents worth.

Good Luck.
.
__________________
David A. Sweet
Variable Data Specialist
HKM Direct Market Communications
Windows 7, Acrobat 10.x
FusionPro Desktop and Server 10.0.26
Reply With Quote
  #9  
Old February 22nd, 2010, 02:46 PM
george.goodeluinas's Avatar
george.goodeluinas george.goodeluinas is offline
Junior Community Member
 
Join Date: Jan 2010
Location: Central PA
Posts: 11
Default Re: OnJobStart data input

So I'm so late responding.... Been out a few days. Thanks to all those who replied. Dan...Your server explanation made perfect sense. Thanks also to those who suggested the external file. I can see where that can be used in a number of places.

Thanks again
George
__________________
Fusion Pro Desktop 6.2P1a
Windows 7 64 bit Home Premium
Acrobat 8 Pro Ver 8.2.0
Reply With Quote
  #10  
Old February 23rd, 2010, 07:16 AM
LesSjo LesSjo is offline
Web-to-Print
 
Join Date: Mar 2009
Location: Fargo, ND
Posts: 92
Default Re: OnJobStart data input

An external file may be a great solution, but if the date doesn't change from record to record, but may be placed in a number of locations, why not just create a rule that returns a specific date and use the rule in the areas where you need the date returned?
Code:
return "January 17, 2010";
I may be missing something here, but why make things difficult on a simple job?
__________________
Lester Sjoblom
Knight Printing
FP Desktop 6.2P1a FP Designer 6.0P1e | Acrobat Pro 9.5.1 |
Mac OS 10.5.8 2.8 GHz Intel Core 2 Duo 4 GB 800 MHz DDR2 SDRAM
Reply With Quote
Reply

Tags
onrecordstart, prompt

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.