Jump to content

Need Help With Surpress Rule


ksulliv1

Recommended Posts

Ok this is going to be a bit long so take a seat. I am trying to create a web form for ordering business cards and the back of the card would look like this.

E username@company.com O 111.222.3333

m 222.333.4444 F 333.444.5555

P.O. BOX 1967 MAIL GHISOC-1 Grand Rapids, MI 49501-1967

HQ 901 44th Street S.E. Grand Rapids, MI 49508

And the fields in the flat file are "email, phonelabel1, number1, phonelabel2, number2, phonelabel3, number3, po, mail, location" and the three phone labels are a pick list being "Mobile, Office, Fax, None".

As you can see each field has a label before it that is in a different font, and size and bold. And all of the fields may or may not be used and if not the field and it's label need to be suppressed. So far I have been able to get everything to work as needed via the Variable Text Editor window and using a rule for each of the text fields "email, po, mail, location" that basically say if the value of each text field is greater than zero then return the correct lable i.e. E or P.O. or MAIL or HQ followed by the information the user types in that field on the form. The phone numbers work the same way with the labels for them being a drop down list that the users picks the type of phone number they are entering, and if they chose None it returns nothing.

The problem I am having is that on three of the lines there are two fields side by side and if I set them to suppress if empty, and the user enters info in one of them but leaves one blank, it still suppresses the whole line and omits the info that was entered.

So I am wondering if a JS could be written to add on to the rules and variables I already have set up for each of the three lines that would produce the results needed. Something that says if both of the text fields on that line are empty then return nothing and move the next line up. But if one or the other or both of the text fields is not empty then return the result according to the rule already set up for that field or both.

Boy that sounds confusing so I hope I made it understandable.

Link to comment
Share on other sites

The problem I am having is that on three of the lines there are two fields side by side and if I set them to suppress if empty, and the user enters info in one of them but leaves one blank, it still surpresses the whole line and omits the info that was entered.

There are two options for suppressing variables. One is to suppress if "containing empty variables" which (in my experience) will suppress an entire line if a single field is empty. The other option is to suppress if "empty" which only suppresses a line if there is no content whatsoever, including all fields and any static text (like spaces). I would think you could choose the latter method to address records with only one field (of two) on a given line.

So I am wondering if a JS could be written to add on to the rules and variables I already have set up for each of the three lines that would produce the results needed.

Yes.

Something that says if both of the text fields on that line are empty then return nothing and move the next line up. But if one or the other or both of the text fields is not empty then return the result according to the rule already set up for that field or both.
It would help to know what rules you have already written to incorporate a fix rather than write a generic rule that you are attempting to hack to fit your current setup. If you are able, perhaps you could post your current FP template in this thread so that we can work with your existing rules. :)
Link to comment
Share on other sites

Thanks for your help. Regarding the suppress if empty check box options, if I use the suppress if empty option it handles the fields correctly, meaning if there is no info in either the line is blank, but if there is info in just one of the fields it returns the correct information. The problem with this option is that when the line is empty, it does not move the content below that line up. It just leaves a blank line in the middle of the card. If I use the suppress if containing empty variables then the copy moves up as it should but if one field is empty and one isn't, it still suppresses the whole line and omits the copy for the one field. (very frustrating)

 

I would be more than happy to post whatever is necessary to make this easier to work with. But please bare with me as I am brand new to this forum, so please tell me what exactly you want me to post, the collected zip file, the pdf, the XML file and is there a size limitation for attachments.

 

Thanks

Link to comment
Share on other sites

Ok again forgive my lack of knowledge, but when you say a space in my field what do you mean exactly? The line in question has two variables on it and two rules preceeding them. I have a spave between each of the four items on the line because I need there to be a space between them when the file is created. Is that what you mean, and should I be doing it differently? I have attached an image of my Variable Text Editor screen to help explain what I mean.

variablelayout.JPG.9a10f71bcad26e4be9323bc7f7ce4be5.JPG

Link to comment
Share on other sites

Ok again forgive my lack of knowledge, but when you say a space in my field what do you mean exactly? The line in question has two variables on it and two rules preceeding them. I have a spave between each of the four items on the line because I need there to be a space between them when the file is created. Is that what you mean, and should I be doing it differently? I have attached an image of my Variable Text Editor screen to help explain what I mean.

 

 

Ok I went back in and removed all the spaces between the four variables on each line, and it did fix the problem with the copy not shifting up to fill the blank line. However now all of my copy on that line runs directly into each other when previewing, so there is no space between items.

 

i.e. "M111.222.333F222.333.4444" when it should be "M 111.222.3333 F 222.333.4444"

 

Any ideas?

Link to comment
Share on other sites

Go into your "rules" for the phone tags and phone numbers and add a space to the end of them. That should give you the desired output you are after.

 

Ok thanks a lot for the help LesSjo I think this is going to work. But I have noticed after playing with it that no matter how many spaces I add at the end of my rule, either in the rule wizard itself or if I do a convert to JavaScript and put spaces after the "HQ" lets say in this example:

 

return "<span>" + String("HQ ") + "</span>";

 

it will only create one space. What if I needed say 2 or maybe 3, I would think it would just be a matter of adding more spaces like this:

 

return "<span>" + String("HQ ") + "</span>"; (sorry I actually had more space between the Q and the ") but it got removed when the post loaded)

 

however that doesn't work.

 

But getting back to my original problem with suppression, you nailed it with the space between the variables the way they were laid out in the editor. Thank you, thank you thank you.

Link to comment
Share on other sites

return "<span>" + String("HQ ") + "</span>";

What you need is a non-breaking space instead of a regular space.

Try something like this:

return "<span>" + String("HQ") + '<  >' + "</span>";

You can play with the number of spaces needed.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...