Jump to content

Value from previous record


havdp

Recommended Posts

I recently saw documentation on a method to compare the current value of a field to the value of the field in the previous record. Now my rules documentation is not available and the only version I've been able to find to download is for FusionPro 6.0. Can someone please tell me what that command is and the syntax for using it?
Link to comment
Share on other sites

I can't build the entire rule for you, but I can try to get you started.

Basically, you're going to be using the ExternalDataFileEx object to iterate through the records, similar to how the "Repeat a record"

example works, except you're not going to be re-writing your input file; you're just going to be looking at the value of the field in each record and comparing it to what you already have. Something like this:

var max_sales = 0;

var max_sales_company = "";

var inputFileName = FusionPro.Composition.inputFileName;

var dataFile = new ExternalDataFileEx(inputFileName, "\t");

for (var rec = 0; rec < dataFile.recordCount; rec++)

{

var sales = Int(dataFile.GetFieldValue(rec, "sales"));

if (sales > max_sales)

{

max_sales = sales;

max_sales_company = dataFile.GetFieldValue(rec, "company_name");

}

}

return max_sales_company;

This is just to get you started. It's off the top of my head, without any real data to test against. So you may have to tweak it a bit.

Link to comment
Share on other sites

I recently saw documentation on a method to compare the current value of a field to the value of the field in the previous record.

In FusionPro 8, you can use the FieldChanged function. This is often used in OnRecordStart like so:

if (FieldChanged("Name"))
   FusionPro.Composition.OpenNewOutputFile();

Now my rules documentation is not available and the only version I've been able to find to download is for FusionPro 6.0.

It's in "/Applications/PTI/FusionPro/Manuals/".

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...