Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Gartner® Magic Quadrant™: 15 YEARS A LEADER - GET THE REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
harshal_shreyesh
Contributor II
Contributor II

How to store special characters in Qliksense variables / How to get dynamic path for datafiles in Qlik cloud spaces

Hello,

I am trying to create if else statement to set the QVD path dynamically if app moves from One space to another. 

 

Let vSpaceName=GetSysAttr('spaceName');
Let vSpaceType = GetSysAttr('spaceType');

If '$(vSpaceName)'='' and  '$(vSpaceType)' = '' then
	Let vSource_Path ='';
    Trace Data sourced from Personal Datafiles';
    
ElseIf WildMatch('$(vSpaceName)','*UAT*') then
	Let vSource_Path = 'RBSPK FACTS Analysis ETL UAT'&':';
	Trace Data Sourced from $(vSource_Path) space;
    
ElseIf WildMatch('$(vSpaceName)','*DEV*') then
	Let vSource_Path = 'RBSPK FACTS Analysis ETL DEV'&':';
    Trace Data Sourced from $(vSource_Path) space;
    
Else 
	Let vSource_Path = 'RBSPK FACTS Analysis ETL'&':';
    Trace Data Sourced from $(vSource_Path) space;
    
EndIf

 

I am trying to get the dynamic path like this for each different space,

 

lib://$(vSource_Path)DataFiles/qvd/

 

Above script works fine in Personal space but fails in other spaces like DEV and UAT. Any suggestions ?

1 Solution

Accepted Solutions
harshal_shreyesh
Contributor II
Contributor II
Author

I was able to  fix it, the issue was just unwanted Single Quote in Trace statement below.

 

 Trace Data sourced from Personal Datafiles';

 

 

When i remove it then the If clause works as expected.

Thanks for you time everyone !! 

View solution in original post

3 Replies
NoahF
Contributor III
Contributor III

Could be different reasons, access right, Case Sensitivity.
However I would start debugging by adding Trace statements to the beginning of the script in order to see, what values the variables evaluate to in the different spaces.

Something like:

 

Let vSpaceName = Alt(GetSysAttr('spaceName'), 'UnknownSpace');
Let vSpaceType = Alt(GetSysAttr('spaceType'), 'UnknownType');

Trace Space Name: $(vSpaceName);
Trace Space Type: $(vSpaceType);

If '$(vSpaceName)' = '' and '$(vSpaceType)' = '' then
    Let vSource_Path = '';
    Trace Data sourced from Personal Datafiles';
    
ElseIf WildMatch(Lower('$(vSpaceName)'), '*uat*') then
    Let vSource_Path = 'RBSPK FACTS Analysis ETL UAT' & ':';
    Trace Data Sourced from $(vSource_Path) space;
    
ElseIf WildMatch(Lower('$(vSpaceName)'), '*dev*') then
    Let vSource_Path = 'RBSPK FACTS Analysis ETL DEV' & ':';
    Trace Data Sourced from $(vSource_Path) space;
    
Else
    Let vSource_Path = 'RBSPK FACTS Analysis ETL' & ':';
    Trace Data Sourced from $(vSource_Path) space;
EndIf

Trace Library Path: lib://$(vSource_Path)DataFiles/qvd/;

 

Then test the script in the DEV and UAT space to see what's happening.

marcus_sommer

The part of: & ':' seemed to be wrong. What about: & '/' 

harshal_shreyesh
Contributor II
Contributor II
Author

I was able to  fix it, the issue was just unwanted Single Quote in Trace statement below.

 

 Trace Data sourced from Personal Datafiles';

 

 

When i remove it then the If clause works as expected.

Thanks for you time everyone !!