Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I create a multi line "SET" statement in script?

I would like to turn a long 1 line SET statement into a manageable 2 or 3 lines like so:

SET variable = "really really really really really really really really really really really really really really really really really really long variable"

to

SET variable = "really really really really really really really really really really really" &

                       "really really really really really really really long variable"

Is there a way to do this with the SET statement or should I just modify the above to a let statement?

thanks,

rich

1 Solution

Accepted Solutions
Not applicable
Author

You can have carriage returns in a set statement but they will be included as part of the variable value. For example:

SET variable =really really really really really really really really really

really really really really really really really

really really long variable;

If you need to remove the return characters you can try to use the replace function (I don't know if you need use chr(10), chr(13), or both as the search string to replace).

View solution in original post

5 Replies
Not applicable
Author

SET cannot evaluate and LET is used to evaluate.

As you have &, I think you dont have an option,other than making it to LET.

Not applicable
Author

I'm using & as an example as a possible delimiter. I don't what the right delimiter is, (or even if there is one).

I actually don't want to evaluate the string as it is full of formulas and I want it to appear as string literal for a field in a LOAD statement.

Not applicable
Author

Can you give me some more info on your requirement.

Not applicable
Author

You can have carriage returns in a set statement but they will be included as part of the variable value. For example:

SET variable =really really really really really really really really really

really really really really really really really

really really long variable;

If you need to remove the return characters you can try to use the replace function (I don't know if you need use chr(10), chr(13), or both as the search string to replace).

Not applicable
Author

Thanks. This works