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 3901 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted
Hi -
I use this calculation to display the value just if the variable have a value.  The problem is when the variable doesn't have a value the calculation add empty spaces to the result.
 
Case ( Length ( $i1 ) > 0 ; $i1 ) & ¶ & 
Case ( Length ( $i2 ) > 0 ; $i2 ) & ¶ &
Case ( Length ( $i3 ) > 0 ; $i3 ) & ¶ & 
Case ( Length ( $i4 ) > 0 ; $i4 ) & ¶ & 
Case ( Length ( $i5 ) > 0 ; $i5 ) & ¶ & 
 
If there is a better way to accomplish this I will appreciate your help.
Thanks
Posted
Case (
Length ( $i1 ) > 0 ; $i1  & ¶ & ;
Length ( $i2 ) > 0 ; $i2  & ¶ &
Length ( $i3 ) > 0 ; $i3  & ¶ & ;
Length ( $i4 ) > 0 ; $i4  & ¶ & ;
Length ( $i5 ) > 0 ; $i5  & ¶ & ;
""
)
Posted
 The problem is when the variable doesn't have a value the calculation add empty spaces to the result.

 

No, that's not what happens. The calculation may add empty rows to the result, not spaces. This could be eliminated by moving the carriage returns inside the Case() function =

Case ( Length ( $i1 ) > 0 ; $i1 & ¶ ) &
Case ( Length ( $i2 ) > 0 ; $i2 & ¶ ) &
Case ( Length ( $i3 ) > 0 ; $i3 & ¶ ) &
Case ( Length ( $i4 ) > 0 ; $i4 & ¶ ) &
Case ( Length ( $i5 ) > 0 ; $i5 )

or doing something much more simple =

List ( $i1 ; $i2 ; $i3 ; $i5 ; $i5 )
Posted

A note on my previous post. The Case function will go in logical order. Once it finds a true statement, it won't evaluate the rest. My post is for one calculation field. If you want it to check each separate variable, you'd have to do each one individually, either by a separate calculation or a separate script step. 

 

Example:

 

Case (

Length ( $i1 ) > 0 ; $i1  & ¶ & ;

""

)

 

______________________________________________________________

 

Case (

 Length ( $i2 ) > 0 ; $i2  & ¶ &

""

)

Posted

Case (

Length ( $i1 ) > 0 ; $i1  & ¶ & ;

""

)

 

That's an invalid expression (which BTW appears also at the end of OP's formula).

 

 

In addition, when using Case(), an empty default result is entirely redundant.

Posted

Hi - Reid

 

Thanks for reply to my topic.

I tried your suggestion but something is missing

Posted

Thanks for the correction comment! I didn't realize empty result was not needed. Putting the ¶ inside the case function makes much more sense. 

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