Six Stars

Dynamic FeildNames Change in a file

Hi Team

From my source file i have to read 11 columns these are static.

Every time feilds count in file will vary

sometimes it is 25 and some time it will be more

is their any way that i can read only that particular 11 fields irrespective of fields count in file.

Thanks in advance

Deepthi

 

3 REPLIES
Twelve Stars

Re: Dynamic FeildNames Change in a file

This tutorial may help you solve this problem (https://www.rilhia.com/tutorials/dynamic-column-order). What you will need to do is set up your file component to read in up to the max number of columns you think may arrive, then use logic similar to that of the tutorial to filter it down to just your required data.  

Rilhia Solutions
Six Stars

Re: Dynamic FeildNames Change in a file

Thanks for your response 

 

That solved my 50% of task

The other issue i have with is Feild name might vary 

ie some time it could be

FirstName

LastName

second Time it could be

FN

LN

third time it could be

LName

FName so how to hand these

Please help me out

Twelve Stars

Re: Dynamic FeildNames Change in a file

Do you have a complete list of the possible field names? If so, you can build them into your dynamic column filtering logic. Alternatively you could import a column by column list into your tMap as a lookup. For example, you might have the following data for firstname and surname....

 

Firstname
FN

FirstN

FName

 

Surname
SName
LastName

LName

 

If you prepared that data into a table/file with a Firstname and Surname column, like below.....

 

Firstname, Surname
FName, SName

FN, LastName

FirstN, LName

 

..... you can test your column names against each of the values in this file/table.

 

This will be a bit tricky to get right, but once the logic is correct you will be able to dynamically add to this list as and when your column headings change.

Rilhia Solutions