Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
markgraham123
Contributor II

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.

Tags (2)
1 Solution

Accepted Solutions
datanibbler
Esteemed Contributor

Re: Select last character in my field

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.

9 Replies
datanibbler
Esteemed Contributor

Re: Select last character in my field

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.

Re: Select last character in my field

try

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

markgraham123
Contributor II

Re: Select last character in my field

So, can i use...

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

datanibbler
Esteemed Contributor

Re: Select last character in my field

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
Honored Contributor III

Re: Select last character in my field

use

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

markgraham123
Contributor II

Re: Select last character in my field

THank you verymuch for the detail explanation

markgraham123
Contributor II

Re: Select last character in my field

Thank you sir.

sasiparupudi1
Honored Contributor III

Re: Select last character in my field

You are welcome

Sasi

MVP
MVP

Re: Select last character in my field

you can use a listbox as in image

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

1.png

same expression in script

Community Browser