October 1, 2018 at 9:36 am #17091
Please have a look at this little chunk of code:
;iRow is an undefined Row variable
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:
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
October 1, 2018 at 9:54 am #17093
- This topic was modified 2 years, 1 month ago by Dario L..
errata corrige: “This way I can create a list and a row within a row variable”October 4, 2018 at 2:48 pm #17141simonepParticipant
my workaround for your code problem:
To init List
To init Row
Row must re-defined by $define() because row() function initialized it with one column with name C1
Enjoy your code.
Simone P.October 8, 2018 at 1:24 pm #17214
Thanks for the answer,
So I was right, the rows can’t be initialized implicitly when created as list/row fields.
Thank you for your workaround, I came up with something similar so I think it could be a good idea to post it along with yours:
Clear list (Hash lists) ;; better safe than sorry
Do iRow.$cols.$add("listValues";kList) ;; list field - still to be initialized
Calculate iRow.listValues as #L8 ;; manual initialization
- This reply was modified 2 years, 1 month ago by Dario L..
You must be logged in to reply to this topic.