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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lmenendez_grupo_pinero
Contributor III
Contributor III

covert to a tex a field content

Hi,

using the function Subfield to separate fields I have problems when there is a ',' inside a field.

In fact it cut all the characters after ','

for example if a field has the text "47,25 for each meter" instead of loading "47,25 for each meter" it only load "47"

I tried changing:

SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';

but it does not work

I think I need a funtion to make consider the total content of the function subfield as text 

something like:

funtionconsiderastext (subfield(@1,';',10)) as okfield

thanks for your help

 

 

 

 

Labels (1)
1 Solution

Accepted Solutions
Raja2022
Contributor III
Contributor III

It will be great if you can provide 10 lines of data, so that I can try it out. But in the mean while based on your reply I created a text file and named it as sampledata.txt and the data in that file is as below:

Prod,code
A,47,25 for each meter
B,50,50 for each meter

Now in the edit script I used file wizard and selected fixed record as shown below:

Raja2022_0-1646312226406.png

Once I clicked 'Finish", I get the following code generated:

LOAD [@1:1] as product,
[@2:2] as dummy,
[@3:n] as code
FROM
[C:\Users\mm\Desktop\sampledata.txt]
(fix, codepage is 28591, embedded labels);

Then I am able to create a chart as below (Where you can see the comma in the code field):

Raja2022_1-1646312348329.png

Note: If you have ';' instead of ',' I think it will still work. 

Give a try and see if that helps or please provide some 10 lines of sample data.

View solution in original post

5 Replies
Raja2022
Contributor III
Contributor III

One way of doing this is adding double quotes. See a sample below:

temp:

Load * Inline [
Prod,code
A,"47,25 for each meter"
B,"50,50 for each meter"
];

Raja2022_0-1646250442614.png

Hope this helps..

 

lmenendez_grupo_pinero
Contributor III
Contributor III
Author

Thanks Raja but the problem is that que data not comes from a load in line , comes from a ordinary load in which there are a log field called @1 , inside this field there are several subfields separated by a delimiter ";".

 

When I use the funtion Subfield, if there is a ',' inside one of the subfields I lose all the charactes after the ','.

Raja2022
Contributor III
Contributor III

It will be great if you can provide 10 lines of data, so that I can try it out. But in the mean while based on your reply I created a text file and named it as sampledata.txt and the data in that file is as below:

Prod,code
A,47,25 for each meter
B,50,50 for each meter

Now in the edit script I used file wizard and selected fixed record as shown below:

Raja2022_0-1646312226406.png

Once I clicked 'Finish", I get the following code generated:

LOAD [@1:1] as product,
[@2:2] as dummy,
[@3:n] as code
FROM
[C:\Users\mm\Desktop\sampledata.txt]
(fix, codepage is 28591, embedded labels);

Then I am able to create a chart as below (Where you can see the comma in the code field):

Raja2022_1-1646312348329.png

Note: If you have ';' instead of ',' I think it will still work. 

Give a try and see if that helps or please provide some 10 lines of sample data.

lmenendez_grupo_pinero
Contributor III
Contributor III
Author

Many thanks for your explanation , the use of 'fixed record' is the solution I was looking for. 

Raja2022
Contributor III
Contributor III

Great and glad able to help... Have a nice day...