Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

Creating New Field in Data Load Editor

Hello Everyone,

I would like your help.

I have some sample data which is very simple, it looks like so:

NameQuestionAnswer
Person 1Question 11
Person 2Question 12
Person 1Question 21
Person 2Question 22
Person 3Question 12
Person 3 Question 22

In the data load editor, I want to make a new field called 'Result' which has two field values 'False' and 'Correct'.

I have tried to do so in the Data Load Editor using this script:

CONCATENATE

[Result]:

LOAD

if([Question]='Question 1' AND [Answer]='1', 'Correct',

if([Question]='Question 1' AND [Answer]='2', 'False',

if([Question]='Question 2' AND [Answer]='1', 'False',

if([Question]='Question 2' AND [Answer]='2', 'Correct'))))

as [Result]

This, however, does not work.

In the data model viewer, the result is this:

Screenshot (98).png

Correct and False are found in a field called Result, but they don't have a relationship with the other fields.

What can I do to solve this.

Thank you all in advance,

Alison

1 Solution

Accepted Solutions

Re: Creating New Field in Data Load Editor

Or just create this in the same table...

TableName:

LOAD Name,

    Question,

    Anwser,

if([Question]='Question 1' AND [Answer]='1', 'Correct',

if([Question]='Question 1' AND [Answer]='2', 'False',

if([Question]='Question 2' AND [Answer]='1', 'False',

if([Question]='Question 2' AND [Answer]='2', 'Correct'))))

as [Result]

FROM ...

3 Replies

Re: Creating New Field in Data Load Editor

May be Join the result back, instead of concatenate

Left Join

LOAD Name,

     Question,

     Anwser,

if([Question]='Question 1' AND [Answer]='1', 'Correct',

if([Question]='Question 1' AND [Answer]='2', 'False',

if([Question]='Question 2' AND [Answer]='1', 'False',

if([Question]='Question 2' AND [Answer]='2', 'Correct'))))

as [Result]

Resident ....

Re: Creating New Field in Data Load Editor

Or just create this in the same table...

TableName:

LOAD Name,

    Question,

    Anwser,

if([Question]='Question 1' AND [Answer]='1', 'Correct',

if([Question]='Question 1' AND [Answer]='2', 'False',

if([Question]='Question 2' AND [Answer]='1', 'False',

if([Question]='Question 2' AND [Answer]='2', 'Correct'))))

as [Result]

FROM ...

Not applicable

Re: Creating New Field in Data Load Editor

Yeah, that one's right, thanks a lot

Community Browser