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

Two table and single condition

Hi all,

I have two tables and I need to implement one single condition like this :

set errormode=0;

Emp:
LOAD Name,
     ID,
     Location
FROM
TestData.xlsx
(ooxml, embedded labels, table is Sheet1); 


Std:
LOAD Std_ID,
     Class,
     Div
FROM
TestData.xlsx
(ooxml, embedded labels, table is Sheet2);

if Scripterror= 11 then
EXIT Script;

ELSE

EXECUTE cmd.exe /c md "A" 2> nul;
EXECUTE cmd.exe /c MOVE /Y "TestData.xlsx" "A\";

But above code will move excel even in one table column structure is changed because of one Excel and two sheets.

what change I need to do in script if one source table got error then it will not move whole excel?

1 Reply
ahaahaaha
Partner - Master
Partner - Master

Hi,

If I understand you correctly, may be check for errors after loading each table?

set errormode=0;

Emp:
LOAD Name,
    ID,
    Location
FROM
TestData.xlsx
(ooxml, embedded labels, table is Sheet1);

IF Scripterror= 11 then

EXIT Script;

ENDIF


Std:
LOAD Std_ID,
    Class,
    Div
FROM
TestData.xlsx
(ooxml, embedded labels, table is Sheet2);

IF Scripterror= 11 then
EXIT Script;

ELSE

EXECUTE cmd.exe /c md "A" 2> nul;
EXECUTE cmd.exe /c MOVE /Y "TestData.xlsx" "A\";

ENDIF