Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to compare variable value to Field multiple values

Hi all,

i am facing some issue recording Compare the variable values  to field values

like i have one variable like -----Vemp='ram'

now i have one table like empid  empname   deptid salary

                                        1      ram               10    5000

                                        2     kiran               11    15000

                                        3      ravi               10    25000

                                        4     kumar             12    35000



now i need to compare variable value to empname field values


like if(empname='$(Vemp)',Deptid,'No Data')

but here i am not able to compare the all fields values to variable values


Could you please suggest the best way


Thanks,

Brahma






1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=Alt( Only({<empname={'$(Vemp)'}>} deptid), 'no data')

View solution in original post

5 Replies
swuehl
MVP
MVP

Try

=Alt( Only({<empname={'$(Vemp)'}>} deptid), 'no data')

View solution in original post

Not applicable
Author

Thanks swuehl ,

it"s working for deptid but

let as assume in table now added a new feild like "referencename"

                       feilds  ---- empid  empname     deptid     salary  referencename

                                        1      ram               10     5000      bobby

                                        2     kiran               11     15000     hari

                                        3      ravi               10     25000     kasi

                                        4     kumar             12     35000     veeru


=Alt( Only({<empname={'$(Vemp)'}>} deptid), 'no data')--it is working good for Deptid


but when i was trying to get related  "referencename" feild value it showing 'nodata'


=Alt( Only({<empname={'$(Vemp)'}>} referencename), 'no data')

Could you please suggest the best way


Thanks,

Brahma

Not applicable
Author

Hi Brahmaiah,

Please use the below expression

SET Vemp='ram'; // declare at edit script

=if(empname=Vemp,deptid,'NoData') // i used this exp at straight table in dimension tab

(or)

=if(empname='$(Vemp)',deptid,'NoData')

i hope this will help you...

Sub2u444

Not applicable
Author

Thanks SubbaReddy ,

it will work but

I need to create all the things in variable level.even "=if(empname=Vemp,deptid,'NoData')"--this function also i need to in create variable  level

Thanks,

Brahma

sandipsatbhai
Creator II
Creator II

Declare variable vName and assign vName='Ram'

in the  straight Chart->Calculated dim (=if(Name=vName,ID)

Expression-->Only(ID) Only(Sal)

Img1.PNG

Hop this will help you.....