Gilbert13 Posted May 16, 2014 Posted May 16, 2014 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
Reid Posted May 16, 2014 Posted May 16, 2014 Case ( Length ( $i1 ) > 0 ; $i1 & ¶ & ; Length ( $i2 ) > 0 ; $i2 & ¶ & Length ( $i3 ) > 0 ; $i3 & ¶ & ; Length ( $i4 ) > 0 ; $i4 & ¶ & ; Length ( $i5 ) > 0 ; $i5 & ¶ & ; "" )
comment Posted May 16, 2014 Posted May 16, 2014 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 )
Reid Posted May 16, 2014 Posted May 16, 2014 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 & ¶ & "" )
comment Posted May 16, 2014 Posted May 16, 2014 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.
Gilbert13 Posted May 16, 2014 Author Posted May 16, 2014 Hi - Reid Thanks for reply to my topic. I tried your suggestion but something is missing
Reid Posted May 16, 2014 Posted May 16, 2014 Thanks for the correction comment! I didn't realize empty result was not needed. Putting the ¶ inside the case function makes much more sense.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now