-
Nested lists/rows not being properly initialized?
Hi all,
Please have a look at this little chunk of code:
;iRow is an undefined Row variable
Do iRow.$cols.$add("List";kList)
Do iRow.$cols.$add("Row";kRow)
This way I can create a list and a row within a list variable. This works without problems.
Now I want to define the inner list and row just created:
Do iRow.List.$cols.$add("Field1";kInteger;k32bitint)
Do iRow.Row.$cols.$add("Field2";kCharacter;kSimplechar;20)
But the result is not as expected, that is the columns are not being created.
Now while playing around I’ve noticed something a little strange: if I inspect the iRow variable (via right click), the inner Row and List fields are present but shown as “Empty”.
Now if I just highlight the “Empty” field with a mouse click, then switch the highlight to another field, it automatically changes to “Not Empty”.
At this point, if I try to rerun the two lines of code above, they work properly and the columns appear.
So, from what I can understand, if an inner row/list is “Empty” I cannot further define it, it seems like the field is there, but not fully initialized. The only way I found to make it work is to use the Calculate statement before doing anything else to the inner list/row.
Calculate iRow.List as lList ; lList is a generic local list variable
Do iRow.List.$cols.$add("Field1";kInteger;k32bitint) ;Now this works as intended
This is kind of a workaround, the only problem is that I get a list with columns but I rather want an empty list to be defined at a later stage, so I’m wondering if there is a better way to handle this behavior, that is changing the state from “Empty” to “Not Empty” via code, not by mouse click.
I’m on Omnis Studio v8.1.5
Thank you in advance
Dario- This discussion was modified 1 year, 9 months ago by Bernhard Mairhofer.
- This discussion was modified 1 year, 9 months ago by Bernhard Mairhofer.
Log in to reply.