Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
Would you please be able to help?
I have a project where I want create a switch between loading data from SQL Select or loading from QVD
ex;
(From SQL)
Table:
LOAD
*;
SQL
Select
*
FROM
brs.qv_sales;
(From QVD)
Table:
LOAD
*
FROM
[$(vFileLocation)D_tSales.qvd]
(qvd);
So what I am trying to do is, create a variable if vLocation = 0 then load data from SQL, if vLocation = 1 then load data from QVD.
Is this possible, please help.
in frontend or script?
In script
Hi,
You can use IF Else in script.
Regards,
Prashant
Hi
syntax should be like
Set vLocation=1;
if '$(vLocation)' = '1' then
SQL Query;
else
QVD query
end if
Regards,
Prashant Sangle
Try like this:
LET vQVDcheck = isnull(QvdCreateTime('QVD Location'));
if $(vQVDcheck ) = -1 THEN
Load from SQL
else
ab:
Load from SQL;
concatenate
Load from QVD;
Store ab in to ab.qvd;
Br,
KC
Hi,
You can also use Switch Case statement.
Syntax :
Let vLocation=1;
Switch vLocation
case 1 :
SQL Query;
case 2 :
Load Query;
End Switch;
Regards,
Prashant Sangle
Hi Prashant,
I have tried the Switch Case statement, but the queries will be a lot as I have a big dashboard, I mean with lots of scripts, and adding Switch Case to each and every query wouldn't look really appealing.
Am I correct that I will need to add the Switch Case statement in each query?
Yes..
Or you can create loop in if else clause.
Regards,
Prashant
You can try this by using variables. If you have 10 load statements, you need 10 variables.
The variable is initialised based on the vLocation. Some thing like below
if vlocation=1 then assign the below to vLoad1
"SQL
Select
*
FROM
brs.qv_sales;
"
if vlocation=0 then assign the below to vload1
LOAD
*
FROM
[$(vFileLocation)D_tSales.qvd]
(qvd);
then you can use the vLoad1 in the script.
hope this helps.