cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Column Names In Link Editor

former_member1170711
Participant
0 Kudos

I am trying to import some log files from a measurement machine into MII and then write them to Oracle tables.  In a transaction, I am reading in the file and then converting it to XML using the flat file parser action block.  After that I essentially want to go through each row, grab the column values, and write them to Oracle.  The problem is the number or columns is variable.  It depends on which test is being run on the measurement machine and it is part dependent.

I want my transaction to be able to handle any number or columns.   After the flat file parsing, the columns look like Column1, Column2, Column3....

What I was thinking I could do is to supply the column name dynamically in an XPATH expression in the link editor.  In this expression:

Repeater_0.Output{/Row/*[name()='Column1']}

if I could dymanically replace 'Column1' with the value of a local transaction variable (so that I could increment the number after "Column" each time through a loop) that would probably get the job done.  This does not work:

Repeater_0.Output{/Row/*[name()=Local.currentCol]}

Is there a way to get a variable value into an XPATH expression like this?  Does anyone see a better way to do this in general?

Thank you,

Mike

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

Single quotes and # tokens around your local property should give you the dynamic text substitution in your xpath:  name() = '#Local.currentCol#'

Have you considered this custom action for converting your flat file?  http://scn.sap.com/docs/DOC-1776

Answers (2)

Answers (2)

former_member1170711
Participant
0 Kudos

Jeremy,

I am using the Advanced Flat File Parser action block.

Your syntax for the dynamic link seems to work.  Thank you!

Mike A was also very helpful.

Thank you both for your support!  I really appreciate it.

Have a great holiday.

-Mike

0 Kudos

Hi Mike,

All the properties that you need to dynamically assign Column headings (variable structure) have existed in MII since 11.5.  I think there is a project mentioned in a recent threads pointing to one (Jeremy?) showing this structure.  In a project I did 5 years ago, I did run into an interesting issue.  I had in excess of 256 columns in some cases of performing this task from Batch process data.  So looking at the result set was not easy (Excel was limited at the time to 256 columns).  Ping me directly, I will see if I can dig up the transactions.

xPath functions which you will need can be found here: http://www.w3schools.com/xpath/xpath_functions.asp

You might have to play around with the syntax within the MII workbench, so ask questions if you run into problems there.

Regards, Mike