Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Objective is i have 2 columns:
TaskName Comments
a b c qwerty
a b c asdfgh
a b c zxcvbn
desired result is below:
TaskName Comments
a b c qwerty
asdfgh
zxcvbn
for this i am using For loop in script and comparing 2 variables by using If statement like below:
if $(a) = $(b) ;
the values in the variables is as below:
If a b c = a b c
Now i get Script line error due to spacing. How to overcome this problem?
thanks in advance
Sukhwant
Hi,
tbl:
LOAD * Inline
[
TaskName,Comments
a b c ,qwerty
a b c ,asdfgh
a b c ,zxcvbn
];
NoConcatenate
SUMARY:
LOAD
TaskName,
IF(Peek('TaskName')=TaskName,'',TaskName) AS TaskNam,
Comments
Resident tbl;
DROP Table tbl;
Why don't you try with Previous/Peek?
Table:
LOAD TaskName,
Comments
FROM Source;
FinalTable:
NoConcatenate
LOAD If(Previous(TaskName) <> TaskName, TaskName) as TaskName,
Comments
Resident Table;
DROP Table Table;
Define your variable as PurgeChar('Taskname',' ')
yes it removed the spaces, but still it is giving same Syntax line error:
If abc = abc
thanks
Can you provide the whole for loop statement you have written. Although what stalwar1 has suggested should work for you.
comments:
NoConcatenate
load
Distinct PurgeChar([Task Name],' ') as ctn
from capacity.qvd (qvd)
where Daterecord = '$(vtoday)' and Status = 'WIP';
comments1:
NoConcatenate
load
Distinct ctn
Resident comments;
drop Table comments;
commentstest:
NoConcatenate
load
Distinct PurgeChar([Task Name],' ') as tn,
Comments as c,
Daterecord as dr
from capacity.qvd (qvd)
where Daterecord >= '$(vlastrundate)' and Status = 'WIP';
commentstest1:
NoConcatenate
load
Distinct tn,
c
resident commentstest
order by tn asc, dr desc;
drop table commentstest;
let i=0;
let comm='';
FOR i=1 to NoOfRows ('comments1')-1
let tn = FieldValue('ctn',$(i));
let j=0;
For j = 1 to NoOfRows ('commentstest1')-1
let tn1 = FieldValue('tn',$(i));
if $(tn) = $(tn1) ;
let comm = $(comm) + FieldValue('c',$(i));
TRACE $(comm);
ENDIF
Next
Next
Not sure Sunny's suggestion will work for me in my future needs as i want to store Text values of Comments column in one variable with the original format ( which includes spaces)
Can you post that error. Which typo error you are facing over there.
Hi,
tbl:
LOAD * Inline
[
TaskName,Comments
a b c ,qwerty
a b c ,asdfgh
a b c ,zxcvbn
];
NoConcatenate
SUMARY:
LOAD
TaskName,
IF(Peek('TaskName')=TaskName,'',TaskName) AS TaskNam,
Comments
Resident tbl;
DROP Table tbl;
The error is caused by the use of the $-sign expansion for a textual field without single quotes. THe correct syntax is this:
IF '$(a)'= '$(b)' THEN ...
Cheers,
Oleg Troyansky
Learn advanced Qlik techniques in my book QlikView Your Business.