Jump to content

Rule Help


Recommended Posts

I have a card that was created before my time that the customer is requesting a change to. It previously was a single sided card, and they are requesting a static back be added. In my mind this was a simple fix but I've been banging my head on this one. When I add the static back it somehow effects the Toll Free Field on the front. When "none" is selected for toll free, it's supposed to drop the tag and leave it blank. It does this just fine until I add the static back. I didn't touch the rules, or anything else just added the back and now it's returning "Toll Free: None" Any ideas?

golf card.zip

golf card wAppointment Back.zip

Link to comment
Share on other sites

Hi, not sure why the rule worked before you added the backer. I couldn't find anything in the code that would make it work as you described. That said, I was able to tweak the Phone Number Rule.


Revised code

I removed Toll Free from numbers and put in a condition to add it to numbers only if it isn't none or blank.

I included a condition in the for loop.

  var numbers =
     "Office": Rule("Office Rule"),
     "Cell": Rule("Cell Rule"),
     "Fax": Rule("Fax Rule"),

     if ((Field("Toll-Free")!="none") && (Field("Toll-Free")!="")) {
         numbers["Toll-Free"] = Field("Toll-Free")+Rule("Hide Ext Label Rule");

 var result = [];
 for (var label in numbers)
     if ((numbers[label] != "none") && (numbers[label] != "")) {
         result.push(label + ": " + numbers[label]);

 var delim = '<color name = "PANTONE 201 C"> • </color>';

 if (result.length > 2 && numbers['Toll-Free'])
     return result.splice(0,2).join(delim) + '<br>' + result.join(delim);
 return result.join(delim);

A couple of other changes you will need to make:

Remove the Hide Ext Label Rule from your Contact Info Frame

Add a space before 'ext' in your Hide Ext Label Rule

 if (Field("ext") == "")
 return "";
  return ' ext.' +Field("ext"); 

On another note, there seems to be a lot of fields and rules that aren't being used, which is one of the reason this took a little while to figure out. You may want to remove the extra code to make it easier to update in the future.

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

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