Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression error displayed, but it still appears to work during script load

----------------------------------------------------

SITUATION (using QV 12.02)

----------------------------------------------------

I'm loading a table and using a FOR loop to cyce through the rows.

AppInfo:
LOAD PadAppName,
     QVWURL,
     LoadExpression
FROM $(vQVDTransformPath)AppInfo.QVD (qvd);

The LoadExpression is a string column, and the value contains the some variation of the following:

MATCH(vServerID, 1, 2, 3) > 0

...where the "1,2,3" will include some variation of that combination of values (i.e. "1", or "1,2", OR "1,3").

My FOR loop is being used to set variables, and looks like this:

LET vServerID = 1;
LET vBtnAppAbortions = '';
LET vBtnAppAlliedHealth = '';
LET vBtnUNKNOWN = '';

LET NumRows=NOOFROWS('AppInfo');
FOR i=0 TO $(NumRows)

    LET vURL      = PEEK('QVWURL',         $(i), 'AppInfo');
    LET vLoopName = PEEK('PadAppName',     $(i), 'AppInfo');
    LET vLoadExp  = PEEK('LoadExpression', $(i), 'AppInfo');

    IF $(vLoadExp) AND LEN(vURL) > 0 THEN
        IF vLoopName = 'Abortions'        THEN
            LET vBtnAppAbortions      = vURL;
        ELSEIF vLoopName = 'AlliedHealth' THEN
            LET vBtnAppAlliedHealth   = vURL;
        ELSE
            LET vBtnUNKNOWN = vURL;
        END IF;
    END IF;
NEXT;

----------------------------------------------------
MY PROBLEM:
----------------------------------------------------
When I reload the script, I get the following error message:

Script line error:
IF  AND LEN(vURL)>0 THEN

As you can see, it doesn't appear to be evaluating the first condition. If I click the OK button, I get the following error message:

Script line error:
END IF

Even though I get those errors, the FOR loop *still* works as expected. When I run it through the debugger, the debugger shows the line being executed as follows (which looks correct to me) :

IF MATCH(vServerID, 1, 2, 3) > 0 AND LEN(vURL) > 0 THEN

-----------------------------------------------------

How can I get rid of these error messages?

2 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Do you have the vLoadExp for all the data table?

Seems to me that some of the fields are populated and others are not, appearing that the first vLoadExp works and others dont.

Can you share your table with full values?

Anonymous
Not applicable
Author

There are 15 rows, and all of the columns in all of the rows are populated (none are null/empty). Review my original post regarding what the error message shows vs what is shown when I step through the code in the debugger.

I fixed it by doing this instead:

FOR i=0 TO $(NumRows)
LET vURL  = PEEK('QVWURL',  $(i), 'AppInfo');
LET vLoopName = PEEK('PadAppName',  $(i), 'AppInfo');
LET vLoadExp  = PEEK('LoadExpression', $(i), 'AppInfo');

IF LEN(vLoadExp) > 0 AND  LEN(vURL) > 0 THEN
IF $(vLoadExp) THEN

IF vLoopName = 'Abortions'  THEN

.....

Notice that I put the check for the result of $(vLoadExp) in it's own  IF...THEN statement.

IMHO, it should have worked the way I had originally written it.