Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sunny_talwar

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 ...

View solution in original post

4 Replies
sunny_talwar

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 ....

sunny_talwar

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
Author

Yeah, that one's right, thanks a lot

tejes
Contributor III
Contributor III

Hi, 

I am having a similar situation but here I do not have the result column, I need to create this freshly in the load script. Since I do not have the result column can I still use below condition or should I create this field in the script, if yes, how to create it

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]