Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankGrimm
Partner - Creator
Partner - Creator

How to use quotation marks in the Qlik Sense Script

Hello together,

I´m using the following script:

test:
load * inline [
a1,a2
a, ' 'A' '
];

test2:
load
TextBetween(a2,''',''',1) as Wert

resident test;

Important:  ' 'A' '   is not a double quotation mark, there are two single quotation marks and A and two single quotation marks.

The content of a2 is 'A'.  Everything perfect!

When I try to extract A (without single quotation marks) from the variable a2 I use the function TextBetween.

The result of Wert is empty.  Not perfect!

 

I tried this option:

test:
load * inline [
a1,a2
a, ' 'A' '
];

test2:
load
TextBetween(a2,"'","'",1) as Wert         //double quotation + single quotation + double quotation 

resident test;

The result is:
 
Der folgende Fehler ist aufgetreten: (the following error accured)
Field ''' not found
 
Der Fehler ist hier aufgetreten:
test2: load TextBetween(a2,"'","'",1) as Wert resident test

 

When I change the script to.:

test:
load * inline [
a1,a2
a, ' *A* '
];

test2:
load
TextBetween(a2,'*','*',1) as Wert

resident test;

The content of Wert is A. Exactly what I need.

Now the question: how to use quotation marks if the value of the data-source contains single quotation marks like ' A'?

 

I used the information's published under:

Using quotation marks in the script ‒ Qlik Cloud

but without success.

 

Thank all.

Frank

Labels (2)
3 Solutions

Accepted Solutions
marcus_sommer

This should work:

test:
load * inline [
a1,a2
a, ''A''
];

test2:
load TextBetween(a2,'''','''',1) as Wert resident test;

- Marcus

View solution in original post

vinieme12
Champion III
Champion III

As below

raw:
load a1,TextBetween(a2, chr(39), chr(39)) inline [
a1,a2
a, ''A''
];

 

OR why not just purgechar() ?

test:
load a1,purgechar(a2,chr(39)) inline [
a1,a2
a, ''A''
];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

FrankGrimm
Partner - Creator
Partner - Creator
Author

Thank you for your answers. You gave me another idea. I´ll use replace  ..

 

test:
load * inline [
a1,a2
a, ' 'A' '
];

test2:
load
TextBetween(replace(a2,chr(39),'*'),'*','*',1) as Wert

resident test;

Now is a2 = 'A' and  Wert = A without quotation marks.

Thanks

View solution in original post

3 Replies
marcus_sommer

This should work:

test:
load * inline [
a1,a2
a, ''A''
];

test2:
load TextBetween(a2,'''','''',1) as Wert resident test;

- Marcus

vinieme12
Champion III
Champion III

As below

raw:
load a1,TextBetween(a2, chr(39), chr(39)) inline [
a1,a2
a, ''A''
];

 

OR why not just purgechar() ?

test:
load a1,purgechar(a2,chr(39)) inline [
a1,a2
a, ''A''
];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
FrankGrimm
Partner - Creator
Partner - Creator
Author

Thank you for your answers. You gave me another idea. I´ll use replace  ..

 

test:
load * inline [
a1,a2
a, ' 'A' '
];

test2:
load
TextBetween(replace(a2,chr(39),'*'),'*','*',1) as Wert

resident test;

Now is a2 = 'A' and  Wert = A without quotation marks.

Thanks