havdp Posted December 6, 2012 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?
Alex Marshall Posted December 7, 2012 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.
Dan Korn Posted December 10, 2012 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/".
Recommended Posts
Archived
This topic is now archived and is closed to further replies.