Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Select last character in my field

Hi all,

In my script, i was trying to restrict few fields as per the requirement.

I have a field "Freight Code".

I wanna set a flag "0" if "Freight Code" has letter 'S' in the end else flag "1".

So, i can fetch the fields only with "Freight Code" which doesn't have letter "S" in it.

Can some look into the application pls.

1 Solution

Accepted Solutions
datanibbler
Champion
Champion

Hi,

you can either load the last letter as a separate field in the script (>> RIGHT([Freight Code], 1 <<)

or you can create a new listbox_object on the GUI using this same formula.

Voila, you can select > S < in this listbox and all the Freight_codes with an S at the end will be selected for you.

HTH

P.S.: Of course, you can also create a flag_field that will show 1 or 0,  either in the script or on the GUI.

View solution in original post

9 Replies
datanibbler
Champion
Champion

Hi,

you can either load the last letter as a separate field in the script (>> RIGHT([Freight Code], 1 <<)

or you can create a new listbox_object on the GUI using this same formula.

Voila, you can select > S < in this listbox and all the Freight_codes with an S at the end will be selected for you.

HTH

P.S.: Of course, you can also create a flag_field that will show 1 or 0,  either in the script or on the GUI.

Kushal_Chawda

try

=if(right([Freight Code],1)='S',0,1) as Flag

markgraham123
Specialist
Specialist
Author

So, can i use...

Where right([Freight Code], 1) <> 'S';

datanibbler
Champion
Champion

Yes, in a LOAD statement in the script, of course you can (as a hint, when you type a command and it does turn blue, then it will work - if it doesn't, you have either misspelt it or it doesn't work in the script - there are commands you can use on the GUI only like SET_analysis.

HTH

sasiparupudi1
Master III
Master III

use

if  (Lower(mid([Freight Code],len([Freight Code]),len([Freight Code])))='s',0,1)   as Flag

markgraham123
Specialist
Specialist
Author

THank you verymuch for the detail explanation

markgraham123
Specialist
Specialist
Author

Thank you sir.

sasiparupudi1
Master III
Master III

You are welcome

Sasi

maxgro
MVP
MVP

you can use a listbox as in image

fabs(not Right([Freight Code],1)='S')

1.png

same expression in script