Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

combining two fields to one

Hi,

My requirement is I have two fields X,Y. X field has  values A,B and Y field has value C..now I want to create a new field Z with values A,B,C. My intention is to create graphs on combined values A,B and C.

Any help is highly appreciated.

10 Replies
MayilVahanan

Hi

Try like this

Test:

LOAD * Inline

[

X,Y

A,C

B,C

];

Load SubField(Z,',') as Z;

LOAD X&','&Y as Z Resident Test;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi

not clear,  how is your data file ? can you put an example.

JJ

CELAMBARASAN
Partner - Champion
Partner - Champion

X,Y,Z are from same table?

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi Mayil

1. Your result will have duplicates if both the field has same values or value appears more than once.

2. Why you need to combine and then separately need to apply subfield over it?

Simply you can do this right?

Test:

LOAD * Inline

[

X,Y

A,C

B,C

];

LOAD Distinct SubField(X&','&Y,',') as Z Resident Test;

Not applicable
Author

X,Y columns are from spreadsheet...

Not applicable
Author

these columns are coming from excel

MayilVahanan

Hi

Test:

LOAD X,Y from filename.xls;

LOAD Distinct SubField(X&','&Y,',') as Z Resident Test;

is not work as you expected?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thank you Mayil Vahanan Ramasamy , i think your solution worked..but in 2nd column there are various value I want to extract only particular value C..consider example two columns State and region

Ca       West

NY       East

TX        South

I need new column Z with values

CA

NY

TX

West..

so, if put the where condition in 2nd column

LOAD Distinct SubField(X&','&Y,',') as Z Resident Test

where Y='West' I'm getting only two values for Z

CA

West

any help is highly appreciated..

CELAMBARASAN
Partner - Champion
Partner - Champion

Use Simply as

Table1:

Load State,Region,State as NewField

from excelSource;

Load * Inline [

NewField

West

];

Edit:

If you need Regions under State starts with c then

Load State as NewField

Resident

Table1 Where WildMatch(State, 'C*');

Hope it helps