Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am facing the following problem
I got many sheets in load like
<sheet1 of script>
table1:
Load
*;
Select * from Dataset //the fields are A, B , C
where date between 2013 and 2014
</sheet1 of script>
<sheet2 of script>
table2:
load *;
Select * from Dataset //the fields are D, E, F
where Date between 2014 and 2015
</sheet2 of script>
and so on.
Could I somehow only reload <sheet2>?
Since the fields are different I can not use something like conditionally where, so i need to do something like:
1) using a Macro that reloads only the code inside sheet2
2) using a condition to read or skip some part of the content, like skip 10 lines or go to next command
Any tips? was the problem clear?
Hi Apolo,
As the script runs sequentially. You can defined variables in the first tab of the script to set up the run order, like this:
<Main Tab>
SET vTab1 = 1;
SET vTab2 = 0;
</Main>
<Tab1>
IF vTab1 =1 then
Load ...
ENDIF
</Tab1>
and so on.
Or you can use subroutines.
Or you can move the tab you want to execute to the very first and then use 'Exit Script' to stop where you want to stop running.
Hope that helps,
Carlos M
Hi Apolo,
check out Partial Reload in the Qlik Help:
https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Partial%20Reload.htm
Andy
No, you cannot use/ignore script tabs by themselves or by switching them on/off. Script tabs are just a cosmetic separation between parts of the same script, to make it more manageable. The script is always executed sequentually, each tab in order and from first tab to the last tab.
You can however change your code to make execution conditional, by:
Best,
Peter
ok, but HOW would I do that?
I know that it is just a cosmetic way, my question is:
<sheet1 of script>
table1:
Load
*;
Select * from Dataset //the fields are A, B , C
where date between 2013 and 2014
</sheet1 of script>
<sheet2 of script>
table2:
load *;
Select * from Dataset //the fields are D, E, F
where Date between 2014 and 2015
</sheet2 of script>
Execute "Reload" only table2, and commenting table1 full script.
I don't think I can use something like:
Let vExecute1 = '0'
Let vExecute2 = '1'
if vExecute2 = 0, then 'nothing'
else
load *;
Select * from Dataset //the fields are D, E, F
where Date between 2014 and 2015
end if;
Hi Apolo,
As the script runs sequentially. You can defined variables in the first tab of the script to set up the run order, like this:
<Main Tab>
SET vTab1 = 1;
SET vTab2 = 0;
</Main>
<Tab1>
IF vTab1 =1 then
Load ...
ENDIF
</Tab1>
and so on.
Or you can use subroutines.
Or you can move the tab you want to execute to the very first and then use 'Exit Script' to stop where you want to stop running.
Hope that helps,
Carlos M
This has nothing to do with sheets or tabs. It has everything to do with how you would like to control the execution of your script. Do you prefer one variable to control execution of conditional blocks? Then you could use something like this:
// Prepare some constants
SET BLOCK1 = 1; // define individual bits as flags.
SET BLOCK2 = 2;
SET BLOCK3 = 4;
// Now flag the blocks that should be executed here:
LET vExecute = BLOCK1 + BLOCK3; // For example, just these two
// Now do what is needed.
// Ignore Execution variable for all code that should always run
IF vExecute bitand BLOCK1 THEN // Flag bit0 set
TRACE >>>> Executing Block1 code;
// Run the Block1 LOAD
LOAD ... FROM ...;
END IF
IF vExecute bitand BLOCK2 THEN // Flag bit1 set
TRACE >>>> Executing Block2 code;
// Run the Block2 LOAD
LOAD ... FROM ...;
END IF
IF vExecute bitand BLOCK3 THEN // Flag bit2 set
TRACE >>>> Executing Block3 code;
// Run the Block3 LOAD
LOAD ... FROM ...;
END IF
// and so on
Yes!! that worked!! thanks!
hmm... seems AMAZING this solution!!!
but I couldn't understand what it does!!
> bitor
I looked for it's explanation but I didn't understand nothing...
The part when you sum the blocks, it make a concatenated field or it just sum their value?
Sorry, should have been bitand. I corrected the code example.
The bit operators can be used to test individual bits in a single value. I use these individual bits to indicate code blocks to be included in script execution. Makes the whole configuration easier to handle.
For example, the value BLOCK1 translates to 8-bit value 1 = 00000001. The value BLOCK3 translates to 8-bit value 4 = 00000100. Simply adding them produces binary value 00000101. BitAnd tests which flags are set, to figure out whether a specific block should be executed or not.
Nevermind, you alread found your solution. Good luck.
either way it is always nice to learn!!! Now I understood what you said!! Thx!!! I'll try this solution and keep the one that works faster!!