strido Posted September 26, 2011 Share Posted September 26, 2011 So here's the deal - I'd like to have the recipient's first name be proper case because they always send it in caps. Looks silly. However, when starting a paragraph with this, it presents a problem when the client leaves that field empty: var Var1 = "RecipientFirstName"; return ToTitleCase(Field(Var1)+", the "); if (Field("RecipientFirstName") == "") return "The " ); I'm trying to do RecipientFirstName in proper case, followed by a comma and the word "the" - using that code above, it will always capitalize the word "the" even if it's not starting the paragraph. I'd like to create a rule that will only capitalize "the" when the Recipient's first name field is empty. Using that rule above, it will capitalize the "The" regardless. Link to comment Share on other sites More sharing options...
esmith Posted September 26, 2011 Share Posted September 26, 2011 You just need to move +", the " outside the right-most bracket. Link to comment Share on other sites More sharing options...
strido Posted September 26, 2011 Author Share Posted September 26, 2011 Looks like I'm still missing the capital "T" in "the" when the field is empty.... Link to comment Share on other sites More sharing options...
esmith Posted September 26, 2011 Share Posted September 26, 2011 Oops, I overlooked the fact that your first return executes outside a loop and so the second two lines never get the opportunity to run. Try modifying your code to read: var Var1 = Field("RecipientFirstName"); if (Var1 == "") return "The "; else return ToTitleCase(Var1) + ", the "; Link to comment Share on other sites More sharing options...
strido Posted September 26, 2011 Author Share Posted September 26, 2011 I just noticed that myself! Doh! Thanks for your help -it's always something silly, eh? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.