rriker Posted May 11, 2011 Share Posted May 11, 2011 I'm putting this out there to see if anyone can help me. I'm attaching my PDF in hopes that someone can check out my rule and figure out what I've done wrong. Basically I have 3 formated text resources for the lower right text box that are as follows "US max format" - should be used when the direct, cell and fax fields ALL have data and card type is US "US main format" - should be used when at least ONE of the direct, cell or fax fields is blank and card type is US "CPH format" - should be used when the card type is CPH. I have a rule called contact format rule that I'm using in the text that is picking up the max format and CPH format correctly but I can't seem to get the rule to correctly pick up the main format. I can normally get these things worked out myself but there must just be something wrong with my logic on this one and I'm teaching myself as I go. I originally tried the same first if statement and then adding if card type is US AND cell is 0 OR direct is 0 OR fax is 0 Then return us main but that didn't work either.33964 CMC cards NEW.pdf Link to comment Share on other sites More sharing options...
esmith Posted May 12, 2011 Share Posted May 12, 2011 Does your data actually have zeroes in fields with no information or are they just empty (null)? If the latter is true, you would need to remove the zero from the check value in all your statements. Other than that, I can't say that I noticed anything glaringly wrong about your logic. In the event that the "zero vs. null" issue doesn't solve your problem, I rewrote your logic manually. See if it gives any better results: var contactFormat = ""; var fieldArray = ["Direct","cell"," Fax"]; if (Field("Card Type") == "CPH") contactFormat = Resource("CPH format").content; else if (Field("Card Type") == "US") { contactFormat = Resource("US max format").content; for (var i=0; i<fieldArray.length; i++) { if (Field(fieldArray[i]) == "0") contactFormat = Resource("US Main format").content; } } return contactFormat; Link to comment Share on other sites More sharing options...
rriker Posted May 12, 2011 Author Share Posted May 12, 2011 Thanks, much! I thought I had tried the 0 thing already since I learned on my last project that the rule wizard is glitchy with that. Just deleted all the zeros again and it works. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.