Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
j_
Contributor
Contributor

Find greater than for string value in tmap

Hi ,

I have a derived field for which i get to populate by checking the if else condition of source field ..The source field is string . ,

Let us assume the field is account .

IF account equals "aa" then the value is "A"

IF account equals "bb" then value is "B"

IF account is GREATER THAN "cc" then value is "D"

Labels (2)
1 Solution

Accepted Solutions
gjeremy1617088143

maybe you can use String.compareTo java method :

ex : "a".compareTo("b") return -1 a<b

"c".compareTo("b") return 1 c>b

"a".compareTo("a") return 0 a=a

 

send me love and kudos

View solution in original post

4 Replies
gjeremy1617088143

Hi, you can try this ternary exrpession:(i assume your input come from row1 main link)

 

row1.account.equals("aa")?"A": (row1.account.equals("bb")?"B":(!row1.account.equals("cc")?"D":(values for other case)))

 

IF account equals "aa" then the value is "A"

ELSE IF account equals "bb" then value is "B"

ELSE IF account not equals "cc" then value is "D"

ELSE VALUE for cc

 

send me love and kudos

j_
Contributor
Contributor
Author

Hi IF case ternary operater is okay but how do we find greater than for string (Ascii code) ..For first 2 case its equal to so its easy..For 3rd its finding greater than value.

gjeremy1617088143

maybe you can use String.compareTo java method :

ex : "a".compareTo("b") return -1 a<b

"c".compareTo("b") return 1 c>b

"a".compareTo("a") return 0 a=a

 

send me love and kudos

j_
Contributor
Contributor
Author

Hi this worked thanks for the reply​