Jump to content

Layouts: If ...then? Choosing to show all or some?


snickwit
 Share

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

Recommended Posts

Hello,

I've been quite a bit of time working on Filemaker for about a year so I'm not a complete newbie though, I have no idea how to post this question or what the feature is called:

I have multiple fields which show Credits that were applied in a DB such as:

1. Pro-rated

2. Family Discount

3. Scholarship

When working on statements layout, I need to itemize where the credits came from. Rather than placing straight text with the above 3 fields, I rather only display the field if the field is not empty. In other words, how do I generate calculation to show only fields that are NOT empty? Do I need to build a long "IF...then ..if, then" formula? I tried CASE but that doesn't work because if there is data on the field 1 and field 3, it only shows field 1 since it is the first match.

Let me know what you suggest or if I need to post this elsewhere. I will be happy to provide more details if needed. I just want to avoid bombarding anyone.

Thanks in advance!

Shelley

Version: v6.x

Platform: Windows 2000

Link to comment
Share on other sites

> how do I generate calculation to show only fields that are NOT empty?

The IsEmpty() function tells if a field is empty or not.

In cases like this I make a single calculation that concatenates the various fields & necessary punctuation.

Example for two text fields separated by a comma when both are present. For total explanation "Left.Text &" could be replaced by:

If( IsEmpty(Left.Text),

"",

Left.Text

) &

The example:

Left.Text &

If( IsEmpty(Left.Text) or IsEmpty(Right.Text),

"",

", "

) & Right.Text

Did I answer the right question?

Link to comment
Share on other sites

Hmm, I see where you are going with this. Pardon me but I'm not exactly sure how I would implement this. Here is what I would like to see as a result - here are is a scenario:

Example 1:

A Field labelled: Prorate = 100

A Field labelled: Discount = (null)

A Field labelled: Famiy = 200

The calculation field in the layout would then show:

"Prorated Discount = $100

Family Discount = $200"

So it would need to know that Prorated is not empty, thus provide:

"Prorated Discount = $" & Prorated

also Family is not emtpy, thus provide:

"Family Discount = $" & "family.

If I concatenated the fields as you suggested, I would get:

"100, , 200" (or would I get "100,,200"???) from the above example.

I have 6 different discounts so would it make sense to generate a CASE formula with 6 different possiblities? I can see how I can use the LEFT, RIGHT ...how can I use that when I am using 6 concatenated formulas since I won't know how many characters to move in the middle?

Thanks again for your help!

Shelley

Link to comment
Share on other sites

Shelley->

Not quite sure I've got it, but here's what I think you're asking:

If( not IsEmpty(Prorated),

"Prorated Discount = $" & Prorated,

""

) &

If( not IsEmpty(Family),

If( not IsEmpty(Prorated),

"PM",

""

) &

Family Discount = $" & "family,

""

)

The "PM": substitute the paragraph mark (3rd down on left of the 8 symbol buttons in the calcuation window) for the PM. The paragraph mark will be in quotes. This gives you a new line after it.

Are the discounts mutually exclusive (only one at a time) or can they occur in any pattern?

Sam

Link to comment
Share on other sites

Thanks for responding. I didn't realize I could do "If ...then" & " If ...then" commands meaning thread multiple "if...then" formulas together. That makes sense now.

As for the discounts, they are in random pattern if that is what you mean? In other words, some folks get 3 discounts, some get none and some get only 1 discount. Does that help?

Thanks again,

Shelley

Link to comment
Share on other sites

Shelley->

My method will work if you have various patterns of discounts.

The If..Then function can usually be placed in a calculation where any value will go. A number example with two If...Thens:

23 + If( A>40, 17, 34) + (12 * If( C=239, 2, 1))

Sam

Link to comment
Share on other sites

This topic is 6517 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
 Share

×
×
  • Create New...

Important Information

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