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: 
Anonymous
Not applicable

Subfield returns first value only

Hi all,

I have an Application field that has either one or more than one Application name. I use a replace to get ride of any spaces. The App names are separated by a comma. My code is as follows:

if(isNull(Application),'NIL', if(Application like '*,*',

        Replace(Subfield("Application",','),' ', ''), Replace(Application, ' ', '')))

The problem is with a value like "App A, App B - XXX, App C - XXX"

The desired result would be like so:

Application...
AppA...
AppB-XXX...
AppC-XXX...

However I am getting only AppA

Application...
AppA...
AppA...
AppA...

Any ideas on how I can achieve this splitting?

Update: Am able to split the Application names correctly, it is when linked with another table that only the first Application name appears in the straight table.

Thanks.

Best Regards

Serena

5 Replies
OmarBenSalem

try this:

load subfield(trim(test),',') as test;

result:

Capture.PNG

devarasu07
Master II
Master II

Hi,

can you share your mock  source data?

also u can try like this (it should work if your application value within double quote)

Fact:

load *, SubField(Application,',') as Application_Revised;

load * Inline [

Application

"AppA,AppB-XXX,AppC-XXX"

];

OmarBenSalem

he has to eliminate spaces in his string before using subfield;

load subfield(trim(Application),',') as Application;

Anonymous
Not applicable
Author

Hi,

Using mock data both fields is correct

testAppTable:

LOAD

if(Application like '*,*',

        Subfield(Replace(Application, ' ', ''), ','),

            Application) as App,

subfield(trim(Application),',') as test,

Application as testApplication,

Subfield(Application, ',') as testSF;

Load * inline [

Application

'AppA,AppB-XXX,AppC-XXX'

'C&S'

];

Am thinking when linked with my report table, somehow only the first App name is kept...

kaanerisen
Creator III
Creator III

Hi,

test:

load

header,

subfield(replace(value,' ',''),',') as result

Inline

[header,value

1,'App A, App B - XXX, App C - XXX'

];

Untitled.png