Jump to content

Trouble using value from CFG file


Recommended Posts

Hello,

 

I have this key/value in my CFG file:

 

oNumber=1219054055

 

And this OnRecordStart Rule

 

FusionPro.thisRuleReturnsTaggedText = true;
//oNumber = 1231234567
var oNumber = FusionPro.Composition.JobOptions.oNumber;
var lastThree = Right(oNumber, 3 );
var firstSeven = Left(oNumber, 7 );
FindTextFrame("orderNumber").content = '<span><f name="Arial"><z newsize="6.0">' +  firstSeven +'</span>' + '<span><f name="Arial"><b><z newsize="8">' + lastThree + '</span>';

 

And a text frame named: orderNumber

 

For the life of me, I am not sure why this does not work ( does not return the value 1219054055 to the text frame) when composing with FP Server. I have tried both 10.0.3 and 9.3.15 Server versions, and it is the same. For the Template creation have use both 9.3.9 and 9.3.40

 

Any input or suggestion is greatly appreciated. Thanks in advance.

Link to comment
Share on other sites

I would first try something like this:

Print("oNumber=" + FusionPro.Composition.JobOptions.oNumber);

And look in the log file to make sure that you're picking up the CFG file value in the first place.

 

Or, just do this from a regular text rule:

return "oNumber=" + FusionPro.Composition.JobOptions.oNumber;

And call that rule out in a text frame, then see what shows up in the output.

Link to comment
Share on other sites

Thanks Dan. I get this in the msg file, 'debug rule' being the text rule you suggested.

 

"Value for variable debug rule not found in instance data"

 

So, I am not picking up the CFG file value in the first place.

 

EDIT: hold the phone..............I just switched up this morning and did an 'On demand' composition and it is working fine. There is a flaw in my testing methodology. Sorry to bother.

 

Here is what I think happened. I was using CMD argument:

 

fusionpro.exe <instance file> <format (the .dif) file> <config file> <output file>

 

And assumed that the DEF file with the same name/folder as the DIF would be used. The DEF file in the CFG had none of the rules I was testing. When I did an On-Demand composition, I defined the path to the DEF (where the darn rules are!).

Edited by kentbaker
Link to comment
Share on other sites

EDIT: hold the phone..............I just switched up this morning and did an 'On demand' composition and it is working fine. There is a flaw in my testing methodology. Sorry to bother.

 

Here is what I think happened. I was using CMD argument:

 

fusionpro.exe <instance file> <format (the .dif) file> <config file> <output file>

 

And assumed that the DEF file with the same name/folder as the DIF would be used. The DEF file in the CFG had none of the rules I was testing. When I did an On-Demand composition, I defined the path to the DEF (where the darn rules are!).

I suspected it was probably a mix-up like that.

 

Note that you can call FusionPro.exe with a single parameter, which is a CFG file, and the CFG file can contain the settings InputFile and FormatFile, to point to the data file and the DIF file, respectively, along with the FlatFileConfiguration setting that points to the DEF file. You can also optionally supply an OutputFile parameter (an output file name will be made up if none is supplied), and a MsgFile parameter (to override the default). This effectively turns the CFG file into a job file, which contains all the information needed to run a job.

 

You might also want to consider using the FusionPro Server API Web Service instead of invoking FusionPro.exe directly.

Link to comment
Share on other sites

Yes, that is what I was refering to by 'On Demand' composition. I also use the Web Service API, but it requires collecting and uploading the template for every change, where with CMD I can just export new DIF and DEF files.

 

Thanks for helping me through this.

Link to comment
Share on other sites

Yes, that is what I was refering to by 'On Demand' composition. I also use the Web Service API, but it requires collecting and uploading the template for every change, where with CMD I can just export new DIF and DEF files.

Newer versions of the Web Service API have a method which allows that kind of "On Demand" composition, where you just supply the command-line parameters for FusionPro.exe. Also, even with older versions of the Web Service, you can still use an override of the DIF or DEF file in a particular composition session, without having to re-collect and upload the entire template.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...