Jump to content

"Hide object when" calc structure


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

Recommended Posts

I'm going beg your indulgence and use my old geezer card since I don't remember how to fix this so it works:

Here's the calc for "Hide object when":

JOB::CountryAbbreviated_Company__lxt ≠ "US"  or ( IsEmpty ( JOB::CountryAbbreviated_Company__lxt ) and MAIN::_g_CountryAbbreviated__gxt ≠ "US" )

Yes, I know it won't work because the equation needs to be Boolean--how do I modify it so it is? As always TIA for your help.

Link to comment
Share on other sites

Hello

Your calculation IS boolean, and your field will hide when either Company__lxt is not equal to 'US' or when BOTH that same field is empty AND the CountryAbbreviated__gxt is not equal to 'US'

So I guess it is a field that should only show for 'US' companies, and not show for international companies?

If it is not performing the way you want, then perhaps the logic is wrong within it?

Link to comment
Share on other sites

2 hours ago, WF7A said:

I know it won't work because the equation needs to be Boolean

I know no such thing, because the formula certainly does return either true or false - so if it won't work the way you expect it to work, it will be for a different reason. In fact, any formula will return a Boolean result when used in a test like this, because Filemaker has a strict set of rules for converting any value to a Boolean.

So the real question here is what are the actual rules you want to apply here. I could not get that from your attempt. I seems to me you may be missing the fact that an empty field does not equal to "US".

Link to comment
Share on other sites

I think you're right about the logic in the equation being screwed up so it's giving the program fits.

Some background: I have two labels on the layout, one has the word PC (for Postal Code) and the other has the word, ZIP (for ZIP code); one or the other will "light" depending on whether the country is "US" (or not)--if it is US, then the ZIP code label will light; if not US, then the PC label will light. In addition to that, if the user hasn't entered a value into a record's local field--the IsEmpty part--then the global field in another table (MAIN) will drive the outcome. (Yes, I suppose I could code a proper calculation field to display the wanted outcome's text--I may go that route if I get too frustrated with the labels.)

Say for the PC label's calc, "US" is entered in the local table's field so we want it to hide itself:

JOB::CountryAbbreviated_Company__lxt = "US"  TRUE 

OR

( IsEmpty ( JOB::CountryAbbreviated_Company__lxt ) FALSE AND MAIN::_g_CountryAbbreviated__gxt = "US" ) TRUE or FALSE, but it's a no-care output because AND's condition will be FALSE no matter what's in MAIN 

...so in this case, you have TRUE and FALSE outcomes so the program's going, "Well...make up your mind since there's no TRUE _or_ FALSE output.

 

Edited by WF7A
Link to comment
Share on other sites

30 minutes ago, WF7A said:

the program's going, "Well...make up your mind since there's no TRUE _or_ FALSE output.

No, that's not how Boolean logic works. There is always only one output, and it's either true or false. In your example, there are 3 propositions (A, B and C) combined into a single statement: 

A or B and C

This statement will be evaluated as follows:

  1. Is A true? If yes, the result is true and evaluation ends here; otherwise:
  2. Is B true? If not, the result is false, and evaluation ends here; otherwise:
  3. Is C true? If yes, the result is true, otherwise it's false.

 

Going back to your specific problem, I am still not sure what rules do you want to apply. Perhaps it would be easier to formulate the conditions for when to show the field, then wrap that in not(). Alternatively, construct a truth table.

Link to comment
Share on other sites

The OR rule states that if any input is true, the output is true; otherwise the output is false. 

The AND rule states that if all inputs are true, the output is true; otherwise the output is false.

Your expression is therefore true OR (true AND false) = true OR (false) = true.

If you are not getting a 1 output, then your input expressions do not reflect the actual conditions you are modeling.

 

Link to comment
Share on other sites

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