Jump to content

Print Field labels only if Not Empty?


Wickerman

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

Recommended Posts

Hi -- simple one, I hope . . .

Let's say I want to create a record Print-Out layout that will include little labels indicating the field (eg. City: Miami), but *only* if there is data in that field. If a field is empty, I don't want a label there wasting space.

What's the best way to achieve this? I'm thinking one way is to set up a whole set of "Print_Field" fields, each with an If (NotEmpty . . . ) calculation that returns the "label:data" only if the field has data in it . . . but that seems like an awful lot of extra field creation (50 fields are suddenly 100 fields now)?

Is there a simpler, more efficient way to go about this?

Thanks!

Wickerman

Link to comment
Share on other sites

I'm sorry, I must not have described the situation very well.

Let's say I have a database of Photographs. There are 50 fields in data entry mode. There are some fields (Say, Title, Cost, Size, Emulsion type . . . ) that will always have an entry, for every record. But there are many other fields that will only be filled if information is known or relevant or if there has been time to enter it, for instance, "Location" or "Subject Keywords."

Let's say I have 25 records in my found set -- I want to print *all* of them. And I want the hard copy to have field labels like "Title: " or "$" or "Size:" to indicate what the various values are.

But I *don't* want to have orphaned labels wasting space when there is no data -- for instance "Location:" with a blank space next to it, and an underlined heading "Subject Keywords" if the cataloguer hasn't entered anything in those fields.

An implication is that a very thorough record with data in *every* field may take 2 pages to print, while most others would fit on 1. Printing a second page full of empty headings is waste.

Does that make sense? I feel like this must be a fairly common situation.

Wickerman

Link to comment
Share on other sites

There are a couple of ways to do this...

This could very very simple with conditional formatting in FM9. Upgrade. :

You can also create a bunch of tabs controls for each label. Each would have 2 tabs; one with the label and the other without. Make sure that these are invisible and have no lines. Set each one up with an object.

Now as part of your print script, you can just go to object [Label9Blank] if you want label 9 not to show, etc. Then you will not have to create all those extra calcs.

Link to comment
Share on other sites

I'm not sure I follow the tabs suggestion, but I hear you on the suggestion that the Conditional Formatting features of FMP9 will make this much simpler. I'll be attending DevCon in July, and if my impression is right, I think I get the version upgrade as one of the goodies. (Don't I?) -- so I think I'll just wait on this little task.

Wickerman

Link to comment
Share on other sites

You can create one calculation field with a text result and build your label in that.

This may help start you off...

Let([

Title = Case(not isEmpty(table::TitleField); "Title: " & table::TitleField & ¶);

Price = Case(not isEmpty(table::PriceField); "Price: " & table::PriceField & ¶)

];

Title & Price

)

You'll need to tweak it to get rid of the trailing carriage return, but I think it sends you in the right direction...

Link to comment
Share on other sites

Well you will get a copy of Advance but its only one copy and if you have multiple users on 8.5 it will not work for them.

Link to comment
Share on other sites

Thanks, DJ, for the suggestion -- I hadn't thought of approaching it in that way -- and I do think that would work well for a small number of fields in a simple layout -- but I'm thinking more of a somewhat elaborate print-out with dozens of fields that I'll want to set in different font styles/sizes, some sliding, etc. It seems like this would be hard to define in a calculation . . . if I'm grasping this right.

Note I'm not trying to print a label -- I'm trying to print a multi-page presentation data in a complete Record -- maybe 50 fields, but some 20 of which could be empty and therefore wasting space if I have all their field labels print out.

albert

Link to comment
Share on other sites

  • 5 years later...
  • Newbies

I have the same problem. A table with about 100 fields, only some of which contain data for each record. I want to print the data I have with field labels but not 3 pages of fields and labels, half of which are empty.

 

I don't want an extra label calculation field for every field because that will slow down my database.

 

I have decided to use a temporary text field ( or maybe two, one for labels and one for the data).

I will use a printing script that:

1) runs through the fields and copies non-blank fields with their labels into the temporary field.

2) goes to a dedicated layout that shows the temporary text field

3) prints the record

4) returns to the original record.

 

That way there is no additional burden on the database and the script should run reasonably fast. The downside is that it will take awhile to write the script with so many fields but I only have to do that once.

 

Also, fields with multiple lines may cause grief if i use a separate field for the labels. If I use one field for both then tab control may be tricky. so that the fields line up vertically.

 

I'll let you know how I get on.

Link to comment
Share on other sites

This topic is 3683 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.