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

[resolved] how to get the column names in a data flow?

Hi 0683p000009MACn.png ,
I'd like to know how to get the column names of a table in a flow of data: excel, delimited or postgresql.
I have to compare them to the ones I should use. It could be via a tMap component.
I must follow a strict naming plan for files and their fields...
Would you know how to get that?
Thanks,
Mathieu
Labels (2)
12 Replies
Anonymous
Not applicable
Author

Hi Feroz,
Following code you can use in your tJavaRow...to get the column names to the context variable.
for (java.lang.reflect.Field field: row1.getClass().getDeclaredFields()) {
context.columnName = field.getName();
      System.out.println("Field name is " + context.columnName );      
           }
You can extend this code for your design...
Vaibhav
Anonymous
Not applicable
Author

Hello, 
I have the same problem: My job consists on doing the mapping of a XML file to a Csv file.But I want to have a second Csv file which contains the columns' names and types of the first.
Do you have an answer please??
Thanks
Anonymous
Not applicable
Author

Hi rloukil,
But I want to have a second Csv file which contains the columns' names and types of the first.

Could you please elaborate your case with an example with input and expected output values?


Best regards
Sabrina