Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted
Case ( 
 
GetAsBoolean ( CB_Sign_Server ) = 1 and
GetAsBoolean ( CB_Sign_Notary ) = 1 and
CB_SSS = "Show server signature" and 
IsEmpty ( CB_NA ) = 1 and
IsEmpty ( CB_CA ) = 1 or CB_CA = "Client address" and
IsEmpty ( CB_NN ) = 1 ; "CB_SSS" ; 
 
GetAsBoolean ( CB_Sign_Server ) = 0 and
GetAsBoolean ( CB_Sign_Notary ) = 1 and
CB_SSS = "Show server signature" and 
IsEmpty ( CB_NA ) = 1 and
IsEmpty ( CB_CA ) = 1 or CB_CA = "Client address" and
IsEmpty ( CB_NN ) = 1  ; "CB_SSS/CB_SSE" )
 
Hello i have i problem regarding on this calc
 
regarding on
 
IsEmpty ( CB_CA ) = 1 or CB_CA = "Client address"
if IsEmpty ( CB_CA ) = 1 the result is "CB_SSS/CB_SSE" that is correct
but if the field CB_CA = "Client address"the result is "CB_SSS" instead of 
"CB_SSS/CB_SSE" 
Posted (edited)

Your example:  Case ( IsEmpty ( CB_CA ) = 1 ...

 

IsEmpty() is a Boolean test so if CB_CA is not empty, the above would translate into human-speak as:  If 1 = 1.  And of course it does.

 

Your example:  GetAsBoolean ( CB_Sign_Server ) = 1 ...

 

If CB_Sign_Server has a number then FM performs the action as:

 

step 1:  GetAsBoolean ( CB_Sign_Server ) ... result is 1.  

step 2:  does 1 = 1 ?

 

I also suspect misinterpretation of and/or construct but see how you go with that once you clean up the above issues.  If the test on either side of the OR is true, it will produce CB_SSS.  If tests on both sides of the OR do NOT evaluate to true then the second portion of the Case() will evaluate.  But there is more ... your second test is identical to the first except for one line (CB_Sign_Server) so you can simplify it ... again using Let() for clarity.

Let (
 sig =
 GetAsBoolean ( CB_Sign_Notary )  // I left it wrapped with GetAsBoolean() but it isn't necessary
 and
 CB_SSS = "Show server signature"
 and
 IsEmpty ( CB_NA )
 and
 IsEmpty ( CB_CA )
 OR
 CB_CA = "Client address"
 and
 IsEmpty ( CB_NN )
;
Case (
 sig and CB_Sign_Server ; "CB_SSS" ;
 sig and not CB_Sign_Server ; "CB_SSS/CB_SSE" ;
 "Neither are true"
) // end case
) // end let

Note also that I dropped the GetAsBoolean() wrapper (for another example).  Listing any number itself is, by its very nature, a boolean test; in fact, all characters can be boolean-tested.  If no number exists in the field, it fails boolean.  Any number (even negative) other than 0 produces boolean true. So if you have a date field and want to know if it is not empty then you can just type yourDateField.  Since all valid dates contain at least one number (1/1/0001) then if any date exists, it evaluates to true.  Same holds if you use not yourDateField.  Boolean tests are efficient, shorter to write and easier to read.  But if a field has only text, boolean can't be used unless you want to test that it contains ONLY text, you could use not yourTextField to guarantee that no numbers exist.

 

I ended your calc with "Neither are true".  You didn't indicate a default result if not CB_SSS or CB_SSS/CB_SSE.  If any records fail to match your tests, what do you want for them?  If you want it left blank then no default result is required.

 

ADDED:  It is quite probable that this calc I gave you will not produce exactly what you want; in fact I didn't plug it in nor test it.  It is pseudo-calc.  But just as in the other calculation we worked through, we usually need to know the rules before we can be exact.  Hopefully this will get you moving forward on it.  And to be clear ... where I put Case ( sig and CB_Sign_Server ... it is saying in human-speak, "if sig has a number (boolean 1) and if CB_Sign_Server has any number then it is true."

Edited by LaRetta
Posted

Thank You Laretta for helping it works but can you help me working on this calculation cause im having trouble, it is not producing the correct result 

im still newbie on filemaker 

 

 

Let ( [
 
CB_SSS =
CB_Sign_Notary
and
CB_SSS = "Show server signature"
and
IsEmpty ( CB_NA )
and
IsEmpty ( CB_CA )
or
CB_CA = "Client address"
and
IsEmpty ( CB_NN ) ; 
 
CB_SSS.CB_NA = 
CB_SSS = "Show server signature"
and
CB_NA = "No address"
and
IsEmpty ( CB_CA ) 
and
IsEmpty ( CB_NN )
and
CB_Sign_Server
and
CB_Sign_Notary ;
 
CB_SSS.CB_NN = 
CB_SSS = "Show server signature" 
and
IsEmpty ( CB_NA ) 
and
IsEmpty  ( CB_CA )  
or   
CB_CA = "Client address" 
and
CB_NN = "No notary"
and
CB_Sign_Server ; 
 
CB_SSS.CB_NA.CB_NN = 
CB_SSS = "Show server sginature"
and
CB_NA = "No address"
and
IsEmpty ( CB_CA ) 
and
CB_NN = "No notary"
and
CB_Sign_Server ;
 
CB_SSS.CB_NA.CB_SSE = 
GetAsBoolean ( CB_Sign_Notary ) 
and
CB_SSS = "Show server signature"
and 
CB_NA  = "No address" 
and
IsEmpty ( CB_CA ) 
and
IsEmpty ( CB_NN ) 
 
];
 
Case (
 
CB_SSS and CB_Sign_Server ; "CB_SSS" ;
CB_SSS and not CB_Sign_Server ; "CB_SSS/CB_SSE" ;
CB_SSS.CB_NA ; "CB_SSS/CB_NA" ; 
CB_SSS.CB_NN and not CB_Sign_Notary ; "CB_SSS/CB_NN" ;
CB_SSS.CB_NA.CB_NN and not CB_Sign_Notary ; "CB_SSS/CB_NA/CB_NN" ;
CB_SSS.CB_NA.CB_SSE and not CB_Sign_Server ; "CB_SSS/CB_NA/CB_SSE" ; 
 
) // end case
) // end let
 
BTW the CB_Sign_server and CB_Sign_notary is a container field
Posted (edited)

If the fields are containers, you must use IsEmpty() test.  Boolean test for number will not work on them.  If the field contains a number then you can use boolean test as I explained; GetAsBoolean() is unnecessary unless you want to force a 1 result.   

 

As for why it doesn't work?  Down in the Case() wrap the containers as indicated in green (I thought they were number originally).  Also, up within your Let(), wrap CB_Sign_Notary with not IsEmpty() and further down, change GetAsBoolean() to (I think) not IsEmpty().

 

Here is how you test each declared variable to find where it is breaking ... you want to take everything down in the calculation portion and comment it out.  You do this by adding a /* to the front of it and a */ to the back of  the Case() like shown in blue

 

];
/*
Case (
CB_SSS and not IsEmpty ( CB_Sign_Server ) ; "CB_SSS" ;
CB_SSS and IsEmpty ( CB_Sign_Server ) ; "CB_SSS/CB_SSE" ;
CB_SSS.CB_NA ; "CB_SSS/CB_NA" ; 
CB_SSS.CB_NN and IsEmpty ( CB_Sign_Notary ) ; "CB_SSS/CB_NN" ;
CB_SSS.CB_NA.CB_NN and IsEmpty ( CB_Sign_Notary ) ; "CB_SSS/CB_NA/CB_NN" ;
CB_SSS.CB_NA.CB_SSE and IsEmpty ( CB_Sign_Server ) ; "CB_SSS/CB_NA/CB_SSE" ; 
) // end case */
 CB_SSS
) // end let
 
... then type the single declared variable you wish to test, like I placed the red and check your results viewing the records.  You can also do this directly in Data Viewer.  So isolate which piece is breaking.  
 
Further, I notice that every single test has the same line:  CB_SSS = "Show server signature"
 
Whenever possible, calculations should be written for efficiency (as long as it does not remove clarity).  So this line uses (or could use) up to five needless evaluations every time it evaluates.  Since you only want it to evaluate if CB_SSS = "Show server signature", remove it from within Let() and wrap it around the entire calculation like this:
 
If ( 
CB_SSS = "Show server signature" ;
 .... then list your entire calculation here ...
)
 
This accomplishes two things:  It reduces the number of evaluations which must take place AND it stops evaluation completely if the record doesn't have 'Show Server Signature".  Again, you do not indicate a default result on the calc.  You can also drop the final semi-colon at the end of your Case() after CB_SSS = "Show server signature".    oops, I meant after "CB_SSS/CB_NA/CB_SSE" 
Edited by LaRetta
Posted

Thanks LaRetta for giving me the correct calculation it really works Thank you so much this helps me a lot   :laugh:  

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