Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi
attached its an example of my problem....
why its stopping in the else inside case 1??
It's a little bit of an oddity as to how the script interpretation and execution flows.
You are triggering Case 2. The statements in Case 1 do not get executed, but they do get expanded and syntax checked.
The variable _vFileExists never get intialized (the LET doesn't get executed) so the IF statement that references it gets expanded to:
"IF =0 THEN"
which is invalid (not trapped until the ELSE).
You can fix the problem by initializing the variable before the SWITCH.
LET _vFileExists = 0;
or code the IF statement to tolerate an empty variable by including quotes.
IF '$(_vFileExists)'=0 THEN
-Rob
Try with this script:
Let _vAction=1;
SWITCH $(_vAction)
CASE 1
LET _vFileName = 'xxxx';
LET _vFileNameD = '$(_vFileName)'&'.qvd';
LET _vFileExists = if(FileSize('$(_vFileNameD)') > 0, -1, 0);
SWITCH $(_vFileExists)
CASE 0
LET _vText1='stops here';
CASE
LET _vText1='why stop here??';
ENDSWITCH
CASE 2
LET _vText='Case 2';
let _vText1='win!!';
ENDSWITCH
replace
IF $(_vFileExists)=0 THEN
with
IF ($(_vFileExists)=0) THEN
It's a little bit of an oddity as to how the script interpretation and execution flows.
You are triggering Case 2. The statements in Case 1 do not get executed, but they do get expanded and syntax checked.
The variable _vFileExists never get intialized (the LET doesn't get executed) so the IF statement that references it gets expanded to:
"IF =0 THEN"
which is invalid (not trapped until the ELSE).
You can fix the problem by initializing the variable before the SWITCH.
LET _vFileExists = 0;
or code the IF statement to tolerate an empty variable by including quotes.
IF '$(_vFileExists)'=0 THEN
-Rob