karlaeprintingedge.com Posted October 24, 2011 Share Posted October 24, 2011 Need help with a ReportWarning rule. I have attached the rule I'm working on. The rule looks at agent's who codes and entering their information from an external file. What I need it to do is report a warning if their is no agent code (pr1) matching in the external file. { Rule("OnJobStart"); } if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true) numRecsExtDF = externalDF.recordCount; for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) if(externalDF.GetFieldValue(recordWalker, 'Who Code') == Field("pr1")) returnStr += '<b>' + externalDF.GetFieldValue(recordWalker, 'Address')+'</b>'; returnStr += '<br>'; returnStr += externalDF.GetFieldValue(recordWalker, 'City'); returnStr += ' '; returnStr += externalDF.GetFieldValue(recordWalker, 'Zip'); returnStr += '<br>'; else { ReportWarning("Who Code " + Field("pr1") + "not found"); } Link to comment Share on other sites More sharing options...
Dan Korn Posted October 24, 2011 Share Posted October 24, 2011 I don't have your data file to test with, but basically you want to finish looping through the records, then check to see you if found anything. Try this: if (FusionPro.inValidation) Rule("OnJobStart"); var returnStr = ""; var numRecsExtDF = externalDF.recordCount; for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { if(externalDF.GetFieldValue(recordWalker, 'Who Code') == Field("pr1")) { returnStr += '<b>' + externalDF.GetFieldValue(recordWalker, 'Address')+'</b>'; returnStr += '<br>'; returnStr += externalDF.GetFieldValue(recordWalker, 'City'); returnStr += ' '; returnStr += externalDF.GetFieldValue(recordWalker, 'Zip'); returnStr += '<br>'; } } if (!returnStr) ReportWarning("Who Code " + Field("pr1") + "not found"); return returnStr; Link to comment Share on other sites More sharing options...
karlaeprintingedge.com Posted October 25, 2011 Author Share Posted October 25, 2011 Worked great, thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.