Ahmad Bukhtiar · Nov 22, 2020

Set property dynamically

If I have table of 60 fields is there a way to add values to columns dynamically ?

Fields are like this Field1, Field2, Field3...Field60 and I am reading data from flat files. I tried below code but it didn’t work

For i=2:1:$LENGTH(line) {

set SourceTable.Field_i = $PIECE(line, "|", i)

0 0 3 154


Hi @Dmitriy Maslennikov 
This suggestion worked thanks, one I am looping over 60 columns and all is working fine. One thing is breaking sometimes data is single codes ' in the text and such records are not being saved. Any suggestion how to handle this?

For i=1:1:60 {
set FieldName = FieldName_",Field"_i
set FieldVaue = FieldVaue_"','"_$Piece(pInput,"|",i)}