Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 12th, 2019, 11:15 AM
Josh Josh is offline
Forum n00b
 
Join Date: Oct 2016
Posts: 6
Default inserting searchable error phrase

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.

Code:
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>';
Reply With Quote
  #2  
Old February 13th, 2019, 01:15 PM
kjacobson's Avatar
kjacobson kjacobson is offline
Junior Community Member
 
Join Date: Oct 2008
Location: Alameda, CA
Posts: 43
Default Re: inserting searchable error phrase

Hi Josh,


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


Code:
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
__________________
Windows 7 | InDesign CC 2017 | Acrobat DC 2019 | FusionPro 10.1.9

Last edited by kjacobson; February 13th, 2019 at 01:23 PM.. Reason: Update
Reply With Quote
  #3  
Old February 13th, 2019, 01:47 PM
Josh Josh is offline
Forum n00b
 
Join Date: Oct 2016
Posts: 6
Default Re: inserting searchable error phrase

KJacobson,

That worked wonderfully!

Thanks a bunch!!!
Reply With Quote
Reply

Tags
error, onrecordstart, search

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:22 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.