Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community.
Please i have a problem with a do loop statement.
This is mi statement:
LET i = 1;
SET ch = "=";
DO while NOT IsNull(FieldValue('RV', i))
 IF(i<>1, $(ch)&"+");
 $(ch) = $(ch) & 'SUM({$<COMPTE={' & FieldValue('RV', i) & '*}>} DEBIT_CLO)';
 i = i + 1;
 LOOP
When i reload my qlikview application, this error is displayed :
Error in expression:
')' expected
IF(i<>1, =&"+")
Please i want your help.
Thanks.
I don't understand the purpose of the first line inside your loop:
IF(i<>1, $(ch)&"+");
What is that supposed to do?
In fact, CH is a string.
I'd like that if the value of the variable i is different from 1,
which is concatenated to the end of the chain CH character '+'
Maybe something like this:
Let i = 1;
Let ch = "=";
do while Not IsNull(FieldValue('RV', i))
if i > 1 then
Let ch = '$(ch)+';
end if
Let ch = '$(ch)SUM({$<COMPTE={"' & FieldValue('RV', i) & '*"}>} DEBIT_CLO)';
i = i + 1;
loop
Hello YIMEN,
you are coding a load-script. There is another syntax as you know from expressions. For ex. the IF-Statements are quite different. Take a look at my script snippet to get a direction:
LET i = 1;
SET ch = "=";
DO while i<3
IF(i<>1) THEN
LET ch= $(ch) & '+';
ENDIF;
TRACE --> $(i): $(ch);
LET i= $(i) +1;
LOOP;
HtH
Roland
Please Roland, can you explain me every statement of your script
Thanks in advance.
Roland Kunle wrote:
Hello YIMEN,
you are coding a load-script. There is another syntax as you know from expressions. For ex. the IF-Statements are quite different. Take a look at my script snippet to get a direction:
<blockquote><pre>
LET i = 1;
SET ch = "=";
DO while i<3
IF(i<>1) THEN
LET ch= $(ch) & '+';
ENDIF;
TRACE --> $(i): $(ch);
LET i= $(i) +1;
LOOP;
HtH
Roland
Please GORAN, How do I see the contents of the variable CH
[quote user="Göran K"]
Maybe something like this:
Let i = 1;
Let ch = "=";
do while Not IsNull(FieldValue('RV', i))
if i > 1 then
Let ch = '$(ch)+';
end if
Let ch = '$(ch)SUM({tiny_mce_markerlt;COMPTE={"' & FieldValue('RV', i) & '*"}>} DEBIT_CLO)';
i = i + 1;
loop
There are several ways:
- you can load in debug mode and inspect the variable ch for each step.
- in your loaded application you can see the variable ch using Ctrl+Alt+V
Hello Yimen,
the syntax of the IF in script is
IF ... THEN ... ENDIF
What you are searching for is the
TRACE $(variable)
to see what is in your variable. And to count your running I use the LET - Statement within the LOOP.
RR
Thanks Sir KUNLE