Trust ID PBCEX logo 300x102

Case Insensitive Expressions [RESOLVED]

4 years 11 months ago 4 years 11 months ago by Philip.
Philip
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Case Insensitive Expressions [RESOLVED] #5494
I am trying to use a Layout Expression and the Mappings window to control which card layout is printed based on a value stored in a database field.

Right now, I have FIELD=='X' on Layout 1 and FIELD='Y' on Layout 2.

This is working properly but only if the value in the database is UPPERCASE.

I tried FIELD.UPPER=='X' and UpperCase(FIELD)=='X' in the expression box, but they did not work.
4 years 11 months ago
Philip
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Case Insensitive Expressions [RESOLVED] #5497
I found another issue in comparing the expression to the database value. I also need to trim white spaces so that "X " would evaluate to "X" and " x " would also evaluate to "X"
4 years 11 months ago
Craig Bechelli
Administrator
Administrator
Posts: 624
More
Case Insensitive Expressions [RESOLVED] #5498
Hi Philip,

The following should work:
(FIELD.strip()).upper() == "X"

Regards,
Craig

Craig Bechelli
CardExchange Solutions Support Team

"If you define the problem correctly, you almost have the solution." (Steve Jobs)
4 years 11 months ago
Philip
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Case Insensitive Expressions [RESOLVED] #5499
Cheers! That seems to be working great.

I now have four different layouts automatically selected based on the four different expected values in a database field.

Is there any way to have a 5th layout that is shown if the field value does not match an expected value?

Right now, I am using expression

(ADDRESS2.strip()).upper()!='W' and (ADDRESS2.strip()).upper()!='X' and (ADDRESS2.strip()).upper()!='Y' and (ADDRESS2.strip()).upper()!='Z'

something like

(ADDRESS2.strip()).upper() not in
or using the mapping to set another variable = true if a match is found. if that 2nd variable is false then only display the "unknown" layout? Maybe this is not the proper place for this or perhaps I need to create a different post?
4 years 11 months ago
Craig Bechelli
Administrator
Administrator
Posts: 624
More
Case Insensitive Expressions [RESOLVED] #5508
Hi Philip,

There is no default setting as such as it may be that either no template or perhaps multiple templates need to be shown.
I think the way you have it setup is the best way to do it, to make sure the "Default" template is shown it really needs to check the conditions already specified.
Although it is a bit of a long condition I think the way you have done it is fine.

Will that be ok ?

If not then like you said the "not in" option may be a good place to look, but you need to define a list of items and that may be tricky to do inline.

Regards,
Craig

Craig Bechelli
CardExchange Solutions Support Team

"If you define the problem correctly, you almost have the solution." (Steve Jobs)
The following user(s) said Thank You Philip
4 years 11 months ago
Philip
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Case Insensitive Expressions [RESOLVED] #5509
Craig:
Thank you for your quick responses. I think I will stick with what I have working. (field != 'x' and field != 'y' and field != 'z' and ......) It is long but right now it is only four conditions so it is manageable.
×

Notice

The forum is in read only mode.