Question
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)
 

1
0 283
Discussion (3)0
Log in or sign up to continue

Hi @Dmitry 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)}