Josh Posted February 12, 2019 Share Posted February 12, 2019 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>'; Quote Link to comment Share on other sites More sharing options...
kjacobson Posted February 13, 2019 Share Posted February 13, 2019 (edited) 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 February 13, 2019 by kjacobson Update Quote Link to comment Share on other sites More sharing options...
Josh Posted February 13, 2019 Author Share Posted February 13, 2019 KJacobson, That worked wonderfully! Thanks a bunch!!! 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.