Jump to content
Server Maintenance This Week. ×

Hiding fields in preview mode based on their contents


This topic is 3960 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've dug around a bit and not found any solutions to my needs, so here I go. I'm guessing for some of you this will be a pretty simple task.

 

What I need is for certain text (simulating field labels) on print layouts to vanish if the merge fields that immediately follow are empty, for example in this case I would want "Birds:" to disappear and then "Cats: have scratchy claws" to move up one line (labels in bold, merge field contents in plain text after):

 

Dogs: have floppy ears

Birds: 

Cats: have scratchy claws

 

Simple, right? Just use conditional formatting. 

 

But wait... The space occupied by the labels if I were to set the conditionally formatted label text to white will randomly mess up the left margins. I have not found a way around this issue.

 

Also, I have quite a few print layouts and they vary widely in the number of fields and amount of content in each field, and they are already laid out with merge fields.

 

What I have done so far is make these fields have the label text be auto entered into the field contents, (the field "Dogs" gets "Dogs: " auto entered for example). The user can then add the remainder of the text to each record (e.g. "have floppy ears"), or just delete everything including the label. This is a workable solution using merge fields, but not too elegant.

 

Of course I could create new text fields in the database for each label, and just have them disappear from from the print layouts using a script when their corresponding field is empty. This would be a lot of work that I'd rather not have to do. I'm looking for a simpler solution, hopefully using my existing merge fields, but if not, using one script that I could apply to a number of fields.

 

I hope I've explained this clearly enough, thanks!

Link to comment
Share on other sites

Things you might want to consider:

1. Have separate "edit" and "print" layouts. 

2. Use a calculated field (instead of merge fields) that combines your label and statement into one line. You can even embed the label on a "TextStyleAdd" function to create the bold font.  The calculation will evaluate to "" if the statement is empty.  No need for conditional formatting. 

3. Create a table of "animals" with one animal listed on each record.  That way you only need to define three fields: 

    a) Animal name, B) Description, and c) merge_calc

4. Use "Sliding up based on all objects above" option, when placing the merge_calc field on the print report. or.... View the animal records in a portal which is filtered based on the criterion:  NotIsEmpty( merge_calc ).

Link to comment
Share on other sites

This is not an issue except for one thing you said. 

"then "Cats: have scratchy claws" to move up one line"

To do that you have to do what Mathew said and use the sliding up or the portal

Otherwise you said you were turning the text white and it was causing issues. Not sure what you meant but instead change the font size to 500. So long as you don't have a big text box the text will be too big to fit. I've attached a sample file. See the conditional formatting layout. The thing is you can not move the other lines up using this method. 

Sample File.fmp12.zip

Link to comment
Share on other sites

Things you might want to consider:

1. Have separate "edit" and "print" layouts. 

2. Use a calculated field (instead of merge fields) that combines your label and statement into one line. You can even embed the label on a "TextStyleAdd" function to create the bold font.  The calculation will evaluate to "" if the statement is empty.  No need for conditional formatting. 

3. Create a table of "animals" with one animal listed on each record.  That way you only need to define three fields: 

    a) Animal name, :cool: Description, and c) merge_calc

4. Use "Sliding up based on all objects above" option, when placing the merge_calc field on the print report. or.... View the animal records in a portal which is filtered based on the criterion:  NotIsEmpty( merge_calc ).

Thanks for the reply Matthew. I hope I described my issue well enough, it was pretty late and I was pretty burned out. Funny thing is, after writing the post I think I have a solution that uses a similar line of thinking to what you've suggested. 

 

1. Yes, I already have separate print layouts.

 

2. This is similar to what I thought of last night. I already have some of the fields set up with the label text auto-entered using TextStyleAdd. I think an "OnLayoutExit" script trigger that strips this label out of the "edit" layout if the field has not been modified will do the trick. Then they won't show up in the merge fields on the "print" layouts.

 

3. If I am reading you correctly, "c)" would basically concatenate "a)" and "b)", and if "b)" is empty, I could script c) to also be empty. Then it would not show up on the "print" layouts. I think I've already solved this dilemma in #2 above... (thinking out loud here...) ;-)

 

4. "Sliding up based on all objects above" is already in use on my print layouts, but only when merge fields aren't being used of course.

 

Anyhow, thanks again for the tips. I'll post back with the results of my efforts.

 

p.s. - "b)" is a smiley... B)

Link to comment
Share on other sites

This topic is 3960 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.