Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CAST in DIRECT QUERY

Hi All,

I am very new to qliksense.

i have a doubt that when i am using CAST function in DIRECT QUERY..it's not working.

EX:->

DIRECT QUERY

dimension

CAST(colA as varchar(30))

measure

A

from table X;

I tried convert function also it also dint work

Please Answer..

3 Replies
petter
Partner - Champion III
Partner - Champion III

You can enclose your CAST in NATIVE like this

DIRECT QUERY

     DIMENSION

          NATIVE( 'CAST(colA AS VARCHAR(30))' ) AS colA

     MEASURE

          A

FROM

     TABLE X;

Not applicable
Author

Thanks Petter, it's working fine now.

could u pls tell me,like if i have to use any other function in my DIRECT QUERY, then i have to use NATIVE..?

And i m trying to use case statement could you pls help me with this also..

EX:->

CASE

when(Pay<=100) then '0 to 100'

when(Pay<=250) then '100 to 250'

when(Pay<=500) then '250  to 500'

end as pay_range;


Not applicable
Author

Sorry peter it worked now,, i used it like

Native(' CASE

when(Pay<=100) then '0 to 100'

when(Pay<=250) then '100 to 250'

when(Pay<=500) then '250  to 500'

end ') as pay_range;


Thanks,

Ankit