Jump to content

Empty field yields poor grammar!


strido

Recommended Posts

So here's the deal. Every week the client sends a new data file with a new problem, apparently to keep me on my toes.

 

This week's fun is as follows:

 

Recipient's first name has several empty fields. Somewhere in the text appears this paragraph:

 

Steve, may I suggest you look into financial....mumbo....jumbo...etc..etc..

 

"Steve" is a rule, to force it to proper case. The remainder of the paragraph is typeset into the text box.

Now, when the recipient's name comes in with their data file empty, it looks pretty crappy:

 

, may I suggest you look into more mumbo jumbo...etc..etc....

 

It's all well and good to just create a rule (and by create, I mean copy an existing one) that will remove that comma. But this presents a problem with the word "may". If I create a rule that says to remove the comma, and insert the capitalized version of the word "may", that's cool - but the next record will wind up being populated, so it'll say:

 

"Steve, May may I suggest..."

 

This is what I have so far:

 

var Var1 = "RecipientFirstName";

 

firstName = Field(Var1);

if (Trim(firstName) == "" ){

return "";

}

return ToTitleCase(Trim( '' + Field(Var1) + ","));

 

 

So the question would be, how could I remove the word "may" from the textbox in the event the field IS populated, yet keep it there for when it's not?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...