Page 1 of 2

How to populate filename to column name in the table

Posted: Thu May 17, 2012 6:22 pm
by sreewin7
Hi Floks,

I have a requirement, my source is sequential files and they want to populate filename to target table one of the column.
Provide me some logic to fulfill this requirement.

Request you to please help me to slove this issue.

Thanks
Sree

Re: How to populate filename to column name in the table

Posted: Thu May 17, 2012 6:41 pm
by SURA
Try with APT_IMPORT_PATTERN_USES_FILESET.

Posted: Thu May 17, 2012 7:19 pm
by Kryt0n
As with what SURA said (if you are trying to use wildcard consumption) and within the sequential file stage, define a column to hold the filename and use the option on the sequential file stage along the lines of "Filename column"

Posted: Thu May 17, 2012 11:10 pm
by ray.wurlod
Don't believe that's possible in a Server job.

Posted: Thu May 17, 2012 11:14 pm
by sreewin7
Thanks very much everyone.

I tried everything , if any one did in server job, please help me.

Regards,
Sree

Posted: Thu May 17, 2012 11:17 pm
by ray.wurlod
Make the file name a job parameter. Use that parameter in the Sequential File stage. Populate the "FileName" output column of a Transformer stage using the same job parameter. Of course, this only works for a single file, but you can use a sequence to loop through a set of file names.

Posted: Thu May 17, 2012 11:27 pm
by SURA
I am not aware that variable is not for Server jobs. I am sorry for that; but did you try to add that variable in the job level and make the default value to 1?

Just interested to see what is a happening?

Posted: Fri May 18, 2012 12:32 am
by ray.wurlod
Any environment variable with APT_ at the beginning of its name applies to the Orchestrate engine (and therefore to parallel jobs only). The same goes for environment variables whose name begins with OSH_.

APT comes from "Applied Parallel Technologies", the name of the company that invented the parallel engine technology before they became Torrent Systems, which was acquired by Ascential Software in about 2003.

Posted: Sat May 19, 2012 2:02 am
by SURA
Hi Ray

Thanks for the clarification. Now i understood.

File_name issue is not resolved.

Posted: Mon May 21, 2012 3:05 pm
by sreewin7
Thanks every, still my issues is not resolved.

Is any other way to finish this task.

Posted: Mon May 21, 2012 3:54 pm
by chulett
What about Ray's advice? Are you not passing in the filename to read as a job parameter? If so, simply leverage that in the appropriate column.

Posted: Mon May 21, 2012 5:07 pm
by sreewin7
Thanks, here my situation is not static it is dyamically changes for every file.
Kindly advice.

Thanks
Sree

Posted: Mon May 21, 2012 6:00 pm
by chulett
Of course, no-one assumed it was static. Answer this: how does the job know what filename to use each time it runs? Is the current filename passed in as a job parameter or are you using some other mechanism?

Re: How to populate filename to column name in the table

Posted: Mon May 21, 2012 6:51 pm
by SURA
How you are going to get the file names?

OR

Every day set of files will be placed in the folder and need to load that?

Is that all the files to the same table / different tables?

So lot of questions behind this!

Though, there are different ways to handle this!

You can use Sequence / routine to achieve this.

You can search for server routine loop / basic code loop and use that to achieve that.

If you are not good with routine, then go for sequence.

Code: Select all

1)cmd activity stage-->2)StartLoop-->3)GetFileName-->4)JobToLoadData-->5)EndLoop
You can use the Unix commands to find out how many jobs you are going to use to run? That count can be the loop counter.

What you have tried so far?

What is your approach?

share with us. Some one will fine tune / correct it

Re: How to populate filename to column name in the table

Posted: Tue May 29, 2012 11:40 am
by sreewin7
chulett
-Sorry for not providing full description.
SURA
- Yes, they are posting total files along with trigger file in one folder ,based on the module.
And i am trying with your logic, and update the status.
Ray -Thanks for your clarification and Thanks every one.

Regards,
Sree