Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SQL script dunno how to write in QlikSense need help.

Hi Everyone,

Im new employee in QLIK in my company.

I hav problems about Two script lines from my example sql procedure:

         ,ISNULL(B.[Dimension Value Code],ISNULL(F.REGIONKL,'')) REG_DIM

       ,IIF(ISNULL(C.DOSTAWA_KRAJ,'')='',ISNULL(G.Country,''),C.DOSTAWA_KRAJ) DOSTAWA_KRAJ



I try to write code at Qlik as :


    

IF(IsNull("Dimension Value Code"),IF(ISNULL(REGIONKL),'',REGIONKL),"Dimension Value Code") as REG_DIM,

    IF(IsNull(DOSTAWA_KRAJ) or DOSTAWA_KRAJ='',IF(ISNULL(Country),'',Country),DOSTAWA_KRAJ) as DOSTAWA_KRAJ,

But My records don't have at all that same values like i will exec full script from SQL.


This is only small section from this code. Whole procedure is much more big, but i didnt saw more operations on this values.

Why i hav problems. That same "company name" from one table hav additional region and country in record, but for other record isn't.

1 Solution

Accepted Solutions
kvanandan1
Creator
Creator

Hi,

Please use the below script in QlikSense to check the null value with len function.

if(len([Dimension Value Code])=0,if(len(REGIONKL)=0,'',[REGIONKL]),[Dimension Value Code])  as REG_DIM

,

if(len([DOSTAWA_KRAJ])=0,if(len(Country)=0,'',[Country]),[DOSTAWA_KRAJ])  as DOSTAWA_KRAJ

View solution in original post

4 Replies
dwforest
Specialist II
Specialist II

why not just use SQL as is in your script...

Anonymous
Not applicable
Author

Becouse i wanna know how to write this as Qlik code, not SQL

kvanandan1
Creator
Creator

Hi,

Please use the below script in QlikSense to check the null value with len function.

if(len([Dimension Value Code])=0,if(len(REGIONKL)=0,'',[REGIONKL]),[Dimension Value Code])  as REG_DIM

,

if(len([DOSTAWA_KRAJ])=0,if(len(Country)=0,'',[Country]),[DOSTAWA_KRAJ])  as DOSTAWA_KRAJ

dwforest
Specialist II
Specialist II

There doesn't seem to be anything wrong with the "translation", so it may have something to do with the rest of the SQL.

Complete code is always preferable and sample data.

Sometimes the issue is not where we think.

Personally, i use SQL or Qlik code based on what is easier to write/understand and prefer as much be done by the database as possible...