Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
RutiTaumanRubin
Creator
Creator

Issue with subfield function

Hi All,

I create calculate dim that extract the data from the word 'Language' till the comma after it.

The calculate :  subfield(subfield(EMAIL_SUBJECT,'Language ',2),',',1)

For example:

DATA
asddsfdsf,Email Language English,try1,try2,Email
Email Language English,sfsdfds,g,gh

 

For both rows I received the word "English".

The problem is that I received the result only when I calculate this in expression but when I moved the calculate to the script I didn't received results:

Load subfield(subfield(EMAIL_SUBJECT,'Language ',2),',',1) AS EMAIL_LANGUAGE

Resident t1

 

Could you please advise?

Thanks!!

 

 

1 Solution

Accepted Solutions
SerhanKaraer
Creator III
Creator III

Hi Ruti,

It seems a problem with commas in your data.

For an Inline table, you can quote your data and then split with subfield.

LOAD DATA, subfield(subfield(DATA,'Language ',2),',',1) as DATA_CLEANSED INLINE [
DATA
"asddsfdsf,Email Language English,try1,try2,Email"
"Email Language English,sfsdfds,g,gh"
];

For other data sources, it depends on the source; but as I mentioned it seems to relate with commas in your data.

View solution in original post

2 Replies
tresesco
MVP
MVP

I can confirm you that this is not an issue with subfield(). The issue would be with your script, it could be wrong field reference, ....just try to investigate and you would get it.

SerhanKaraer
Creator III
Creator III

Hi Ruti,

It seems a problem with commas in your data.

For an Inline table, you can quote your data and then split with subfield.

LOAD DATA, subfield(subfield(DATA,'Language ',2),',',1) as DATA_CLEANSED INLINE [
DATA
"asddsfdsf,Email Language English,try1,try2,Email"
"Email Language English,sfsdfds,g,gh"
];

For other data sources, it depends on the source; but as I mentioned it seems to relate with commas in your data.