Jump to content
Welcome to the new FusionPro User Forum! ×

ReportWarning Rule


Recommended Posts

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

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

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