Jump to content

inserting searchable error phrase


Josh

Recommended Posts

I am trying to ensure that no matter the amount variable tagged text elements we have, that we can search the output for missing variables from the data.

 

I know I would have to do something along the lines of the following JS for each variable we use, but I am hoping I can do this in the OnRecordStart rule and it will work in the individual text rules that already exist outside of the ORS.

 

var greetingText = '<span color="' + Greet_color + '" font="' + Greet_font + '" pointsize="' + Greet_size + '">';

//Inserting Empty Field! when data is absent
if (Field("Greeting") == "")
   greetingText += "Empty Field!" + '</span>';
else
   greetingText += Field("Salutation") + " " + Trim(Field("Greeting")) + Field("Punctuation") + '</span>';

Link to comment
Share on other sites

Hi Josh,

 

 

This should get you started. You can put this in your OnRecordRule and it will return "Error" when a field is empty.

 

 

for (var field in FusionPro.Fields) {
   result = Field(field);

   if (result == "") {
       result = "ERROR"
   }

  FusionPro.Composition.AddVariable(field, result);

}

 

 

More information about this can be found in these threads:

http://forums.pti.com/showthread.php?t=5040

http://forums.pti.com/showthread.php?t=1913

 

 

UPDATE: This doesn't appear to work to replace fields placed in rules. I will see if I can find a solution unless you or someone else beats me to it. (c:

 

 

 

Hope this helps.

 

 

- K

Edited by kjacobson
Update
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...