Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a small piece of code which basically checks if the question is 2 or 3 and
If the question is 3, it saves the corresponding answer as Final answer.
What I need is if the question is 2, it shows test for now but I would still like to save the Final answer as whatever was answer for question 3.
Is there a way I can achieve this? Any help will be appreciated
LOAD distinct
DataPoint,
if (Question=3,Answer,'test' ) as [Final Answer]
FROM
$(vQVDLocation)DataPointAnswerChoice.qvd
(qvd) where match(Question,2,3);
The pseudo code is something along below lines
if( question =3, answer, ( answer where question would have been 3) )
Tbl:
LOAD distinct
DataPoint,
if (Question=3,Answer,'test' ) as Answer3,
Question
FROM
$(vQVDLocation)DataPointAnswerChoice.qvd
(qvd) where match(Question,2,3);
Join(Tbl)
LOAD
DataPoint,
2 As Question,
Answer As Answer2
FROM
$(vQVDLocation)DataPointAnswerChoice.qvd
(qvd) where Question=3;
Final:
Load *, if (Question=3,Answer3,Answer2 ) as [Final Answer] Resident Tbl;
Drop Table Tbl;
Maybe firstsortedvalue is the answer
How is your data structured.
Could you post an examples?
Do you want to save the answer from question 3 as the answer for question 2?
-Rob
Yes
Thanks, i'll look up firstsortedvalue. The data structure is complex and I do a lot of manipulations but basically it has a column to note the questions and answers as shown above.
What is the common field between rows where Question is 2 or 3?
Does both rows have same datapoint?
Yes Data Point is the same.
If DataPoint is same and if you assign Answer of Question=3 to Question=2, both the rows will have same values as you have only two fields selected in Load statement. Then why do you need to assign Answer of Question=3 to Question=2?
I actually have more statements like assigning the score and time stamp. I just copied the part where I assign value to Final Answer. I also have series of load statements written when question equals to 4, 5 etc,,
Post some of your data to better understand your requirement