Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor II

Store into Different Library Based on Computer Name

Hello, I have an application that as I move up through our environments the store to drops to different folders. 

For example if I am in the dev environment (Call it computer A) I want the file to drop to:

\\bifileshare\ApplicationOwnerFiles\Global_Finance\Concur_Extracts_QVD_Creator\Concur_Extracts_QVD_Creator_QVD\

If I promote it to our prod environment (call it Computer B) I want the file to drop to:

\\bifileshare\Concur_Qlik_Extracts\QVD\

To accomplish this I set up a few variables but I can't get the syntax correct in the if statement.  

Let v_qsenvironment = ComputerName();
let v_devqvdlib = '\\bifileshare\ApplicationOwnerFiles\Global_Finance\Concur_Extracts_QVD_Creator\Concur_Extracts_QVD_Creator_QVD\';
let v_prodqvdlib = '\\bifileshare\Concur_Qlik_Extracts\QVD\';
 
 if v_qsenvironment ='Computer A' then 

store extract_CES_SAE_v3_2020 into '($v_devqvdlib)'/extract_CES_SAE_v3_2020.qvd' (qvd);
 
if  v_qsenvironment='Computer B' then 
 
store extract_CES_SAE_v3_2020 into '($v_prodqvdlib )'/extract_CES_SAE_v3_2020.qvd' (qvd); 
 
endif;
 
Any help would be appreciated.
 

 

 

3 Replies
Highlighted
Valued Contributor

Re: Store into Different Library Based on Computer Name

Hi @carlcimino 

Maybe try the following with the red removed and the green added:

Let v_qsenvironment = ComputerName();
let v_devqvdlib = '\\bifileshare\ApplicationOwnerFiles\Global_Finance\Concur_Extracts_QVD_Creator\Concur_Extracts_QVD_Creator_QVD\';
let v_prodqvdlib = '\\bifileshare\Concur_Qlik_Extracts\QVD\';
 
 if v_qsenvironment ='Computer A' then 

store extract_CES_SAE_v3_2020 into '($v_devqvdlib)'/extract_CES_SAE_v3_2020.qvd' (qvd);
 
elseif  v_qsenvironment='Computer B' then 
 
store extract_CES_SAE_v3_2020 into '($v_prodqvdlib )'/extract_CES_SAE_v3_2020.qvd' (qvd); 
 
endif;
 
Hope this helps.
 
Regards,
Mauritz
Highlighted
Contributor II

Re: Store into Different Library Based on Computer Name

 

Hi @Mauritz_SA thanks for the suggestion!  I know it has to be something with syntax.  When I used what you got the error below when I tried your suggestion.  Here's what I did to test it out.

Let v_qsenvironment = ComputerName();
let v_devqvdlib = '\\bifileshare\ApplicationOwnerFiles\Global_Finance\Concur_Extracts_QVD_Creator\Concur_Extracts_QVD_Creator_QVD\';
let v_uatqvdlib = '\\bifileshare\ApplicationServerFiles\02_uat\QS\shared_misqs-uat.chubb.com\SourceDocuments\Global_Finance\Concur_Extracts_QVD_Creator\QVD\';
let v_prdqvdlib = '\\bifileshare\Concur_Qlik_Extracts\QVD\';

 

extract_CES_SAE_v3_2020:

Load
   makedate(2019,12,31as "Batch Date"
AutoGenerate
    (1);


if v_qsenvironment ='NAUSD-WAPP0512' then 

store extract_CES_SAE_v3_2020 into '($v_devqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd);
 
elseif  v_qsenvironment='NAUSP-WAPP0509' then 

store extract_CES_SAE_v3_2020 into '($v_prodqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd); 

endif;

drop table extract_CES_SAE_v3_2020
;

exit script;

 

 

error.jpg

 

 

Highlighted
Valued Contributor

Re: Store into Different Library Based on Computer Name

Hi @carlcimino 

Sorry, I didn't see that you dollar signs weren't outside the brackets🙈. The following:

store extract_CES_SAE_v3_2020 into '($v_devqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd);
elseif  v_qsenvironment='NAUSP-WAPP0509' then 
store extract_CES_SAE_v3_2020 into '($v_prodqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd); 
 
Should be:
 
store extract_CES_SAE_v3_2020 into '$(v_devqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd);
elseif  v_qsenvironment='NAUSP-WAPP0509' then 
store extract_CES_SAE_v3_2020 into '$(v_prodqvdlib)extract_CES_SAE_v3_2020.qvd' (qvd); 
 
Hope this fixes it.
 
Regards,
Mauritz