Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
RSvebeck
Specialist
Specialist

concatenate all fields from a table into an Variable

Hi

I want a variable to contain a comma separeted list of all fields from a specific table, or from all possible tables.

I would prefere a solution in the load script or an expression, but not a macro solution.

Is it possible?

(A bonus task would be to be able to exclude some fields in the variable.)

I guess the best solution would be a For Each - solution, but Im not finding the way to loop fieldnames in a table.

Best Regards

Robert

Svebeck Consulting AB
1 Reply
marcus_sommer

Hi Robert,

this example list all fields from last load.

let vLoadTable = TableName(NoOfTables() - 1); // Name der zuletzt geladenen Tabelle wird ausgelesen

let vLoadFieldCount = NoOfFields('$(vLoadTable)'); // Anzahl der Tabellenfelder wird ausgelesen

let vLoadFields = ''; // Variablen-Inhalt löschen

for i = 1 to $(vLoadFieldCount)

    let vLoadFields = '$(vLoadFields)' & FieldName($(i), '$(vLoadTable)') & ', '; // Felder der Tabelle werden String verkettet

next

- Marcus