Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
stevelord
Valued Contributor

consolidated if statement

Hi, I have a variety of if statements to pivot data like this:

    if(AttributeName='Challenge' AND AttributeValue, AttributeValue) as [Email New Inquiry Challenge],

     if(AttributeName='Forms' AND AttributeValue, AttributeValue) as [Email New Inquiry Forms],

     if(AttributeName='General Program' AND AttributeValue, AttributeValue) as [Email New Inquiry General Program],

     if(AttributeName='Gift Card' AND AttributeValue, AttributeValue) as [Email New Inquiry Gift Card],

Is there a single statement I can write to create these fields?  Something like this in concept:

if(AttributeName AND AttributeValue, AttributeValue) as ['Email New Inquiry '&vAttributeName']

I had to unpivot lots of data due to varying field headers to get it loaded, and am using the if statements above to re-pivot the data from a single table.  Many files have shifting names of operators for their field headers, or maybe a new inquiry type can be added etc, and I'd like the script to add new people itself without me having to keep track or anyone else having to communicate to me.

...and it just occurred to me the data sets for the particular dashboard that made me ask this question may not become too huge to just let a pivot table handle it, but still a correct answer to above would be helpful in other places where I do have huge data sets.

I will tap points to whoever solves above for me.

Thanks!

1 Solution

Accepted Solutions
Not applicable

Re: consolidated if statement

Look for Generic and CrossTable statements.

regards

Darek

3 Replies
Not applicable

Re: consolidated if statement

Look for Generic and CrossTable statements.

regards

Darek

Not applicable

Re: consolidated if statement

Hi Steve, Use Generic Load to Pivot the table. Please go through the below blog post as reference.

http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/31/generic

stevelord
Valued Contributor

Re: consolidated if statement

generic load was the one I was forgetting.  (It gave wonky results on a very large data set with unique qualities that I had to pivot with if statements, but looks okay for this.)

Community Browser