Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

string variable not working

I have string variable

let d1 = 'Name1 & ''|'' & Name2'

but when I try do this

$(d1)

get this :

"Syntax error, missing/misplaced"

In MS SQL script is no problem .

Please help me

best regards Vilgis

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

function relace(string_text_value,'''',''') not working

but replace(string_text_value,'''',chr(39)) working

View solution in original post

3 Replies
SunilChauhan
Champion II
Champion II

let d1 = 'Name1 '& '|' & 'Name2';

or

let d1 = Name1 & '|' & Name2;

Names are field;

Sunil Chauhan
Not applicable
Author

Thanks Sunil for reply

I just create string by this formula :

TableOfHierarcy:

hierarchy (ID, ParentID, Name, 'ParentName', Name, 'Path', '|', 'Depth')

load
    
ID,
    
ParentID,
    
Nameresident TableOfNodes;
;
LET a = NoOfFields('TableOfHierarcy');

LET b = 1;

Let i = 1;

LET c = '';

LET d = '';

LET d1 = '';

for b = 1 to a-6
    
for i = 1 to b
          
c = c &  ' Name' & $(i) & ' &'
    
next
    
c = left(c,len(c) - 1)    & ' as new_name' & $(b) &' ,'
    
NEXT
d = left(c,len(c)-1);

I want instead symbol '&' replace '&'|"" . But not working

//And d variable is d = '

Name1  as new_name1 , Name1 & Name2  as new_name2 , Name1 & Name2 & Name3  as new_name3

'

Not applicable
Author

function relace(string_text_value,'''',''') not working

but replace(string_text_value,'''',chr(39)) working