havdp Posted December 6, 2012 Share Posted December 6, 2012 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? Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted December 7, 2012 Share Posted December 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted December 10, 2012 Share Posted December 10, 2012 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/". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.