Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Edit Script

I have 5 different SQL summaries feeding my dashboard.

They all join to each other (on different fields) so I can have my data set.

How and where would I write in a IF statement - would I create a new section at the end of the 5 SQL summaries?

Any ideas would help.

1 Solution

Accepted Solutions
Not applicable
Author

7 Replies
MK9885
Master II
Master II

You want to create new fields in script using IF statement?

If yes, then I believe you'd have to either do preceding load or resident load (separate table with one common key joining your 5 table(one fact).

If preceding load then before your load statement, take the field name you suppose to modify and create a new field.

I'd rather first join all the tables as a raw extract table into one fact, store that into QVD (check fact table name, usually the Fact will be created based on your First Table Name)

Load the fact QVD, do preceding load to Qlik script using IF statements.

I'm talking about Qlik Scripting, not SQL script (which I've no idea about)

Consume SQL script, store into qvd, consume qvd, transform it. Much simpler I guess.

Experts might disagree

Not applicable
Author

Aehman -

Yes, I already have the QVD in place for the load and I end up with one "table" if you will.

Could you give me an example of a preceding load?

Let's say Qlik Sense runs it's process and goes through all my SQL summaries - then disconnects from my source. How would I tell QlikSense to continue on to the Preceding section and how exactly would I format it?

I just need an example of the layout and an understanding of how I could write conditions based on my load.

MK9885
Master II
Master II

//After storing a QVD (Extract Layer) and fetching QVD Table in new QVF (Transformation Layer)



FactTable:

//Preceding load

Load *,

if(YourFieldName='Yes', 'Show', 'Hide') as NewField;

///Normal Load

Load

......

From....

YourFieldName should be present in your Normal Load table to do the preceding load.

You can do more than 1 Preceding load

And I think it won't effect if Qlik is reading data from SQL and updating it.

As you're doing transformation and creating new field, your old fields gets updated and your new fields will update as well (as it will be looking for values from old field, stored in qvd and applying transformation to new field)

brunobertels
Master
Master

Hi Lauren

Have a look to this post

Preceding load: https://community.qlik.com/blogs/qlikviewdesignblog/2013/03/04/preceding-load

Not applicable
Author

Thank you - I will take a look at this!

Not applicable
Author

My IF statement has fields from multiple SQL (5). I'm worried that this won't work because of this.

I have 5 SQL that at the end of each I have go to a QVD - then I do an inner join table with the QVD files at the end.

Where and how would I place this new load?

Not applicable
Author

If Match Statement

^ Question Answered Here