Dynamically define the column names

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Dynamically define the column names

Post by Nagaraj »

Hi Folks,

In one column i have data like this,

hsd sdj hds ddh sdh hsd
hsd djd
ggh hsd jsd

i have to derive columns based on the delimeter, but the no of columns are dynamic, lets say we can find out the number of columns coming thru in each record. So is there any way of assigning each value to the subsequent columns defined in the transformer.

Thanks
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Column Export ?
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

No

we are not sure how many columns we get...!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But do you know the maximum number you could get?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

I assumed it cannot go more than 20 values like that and coded accordingly, its working but i wanted to code dynamically.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In that case, how do you intend to store in the target ?

Generally the target is a db and cannot have dynmically changing structure.

Maybe more information on your requirement will assist others in helping you.
srividya
Participant
Posts: 62
Joined: Thu Aug 25, 2005 2:31 am
Location: Ashburn,VA

Post by srividya »

:idea: May be the data is record type driven, say the first 3 places are 001 then it is for one kind of data , if it is for 008 it is another set of data
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

Yes Kind of Srividya,

I am defining n no of columns in transformer and after that i am funneling all the values so that it goes to one column, but in between i should apply different rules i wll have to treat my source column with many values as some array.
srividya
Participant
Posts: 62
Joined: Thu Aug 25, 2005 2:31 am
Location: Ashburn,VA

Post by srividya »

will you be able to give a more specific screen shot of data than what you have already given? That would help us understand how the feed would look like
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

So, do you want to normalise the structure ?
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

i have two columns


A B

1 gfg gfg kzl dsk gdg
2 hdh hdh
3 dhd dhd hdh jdk jdj jdj kjd


column B values will be further derived and added in the end, doing group by column A.

Thanks
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Looks like you are trying to do a classic pivot? do you want multiple rows --- one for each of the "B's" (each 3 character value to have its own row)?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

Please see the questiona again, i dont have problems with pivoting,
i want to calculcate how many values are there in an array and accordingly i have to put each of them in seperate columns(which has its own derivation), in the end i am funnelling.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

How will you identify the individual column name for the column B.
Could you write up the expected output?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

it has a delimeter, please see the first question asked initially.
Post Reply