1 Reply Latest reply: May 22, 2013 7:11 AM by Marcus Sommer RSS

    concatenate all fields from a table into an Variable

    Robert Svebeck

      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

        • Re: concatenate all fields from a table into an Variable
          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