Integrated Application Platform › Forums › General › Using Repeat Control for Data Entry
- This topic has 5 replies, 3 voices, and was last updated 5 years, 9 months ago by
ajith.
-
AuthorPosts
-
February 5, 2018 at 2:02 am #1365
ajith
ParticipantHi,
Suppose I have an Access defined as
Controller { Controls: ('Access' 'mytable' #(Vert field_1 field_2 (Repeat(Horz sub_1 sub_2))))}
for entering data into mytable with the fields field_1, field_2 and field_3.
How can I get the data from the Repeat get filled into field_3 of the relevant record?Note that my query is related to what was discussed in https://suneido.com/forums/topic/a-field-to-enter-structured-text/
Thanks,
ajithFebruary 5, 2018 at 2:19 am #1366amckinlay
KeymasterHi Ajith,
I think all you need to do is add name to the Repeat
(Repeat (...) name: field3)
Andrew
February 6, 2018 at 5:06 am #1368ajith
ParticipantHi Andrew.
Yes, that small addition does the magic.
But, when the layout is complex, I get an error message – uninitialized member: “Name”
This happens when Repeat is kept inside two containers of the same type as in this example#(Vert field_a field_b (Horz Fill Vert( (Repeat(Horz sub_1 sub_2) name:field_c)))))
Adding a Name:”V2″” to the inner Vert brings another error- uninitialized member: “YStretch”.
Please do explain a bit of what is happening when a name argument is given / which other controls can be used in a similar fashion to enter data into a field (without using a field definition).
Thanks,
ajithFebruary 6, 2018 at 5:38 pm #1371amckinlay
KeymasterI’m not sure what the errors are from. I’m traveling again (and so is Jeff), but I’ll see if I can get someone to look into it.
“name:”, which becomes .Name after construction, is used for several things. For example, when you refer to a control by e.g. .Horz.Field the “Horz” and “Field” are the names of the respective controls. A lot of controls have default names (look for Name: on the class) but the default name can be overridden by specifying name: on the control specification e.g. (Horz … name: myhorz)
When you specify just a field name, so the control comes from the Field_ definition, then the name is automatically set to the field name.
RecordControl also uses the names as the field names in the record that it manages. This works with any control that is “data aware” i.e. Send ‘Data’, ‘NewValue’, and ‘NoData’. Most of the standard controls e.g. Field and CheckBox are like this.
I hope that helps explain it a little.
February 6, 2018 at 6:10 pm #1372liqian
ParticipantHi Ajith,
I think you have wrong parentheses around vert
Please try the following code:
Controller { Controls: ('Access' 'mytable' #(Vert field_1 field_2 Fill (Vert (Repeat (Horz sub_1 sub_2) name: 'field_3') ) ) ) }
February 7, 2018 at 12:52 am #1373ajith
ParticipantHi Andrew and Liqian,
Thanks for the explanation and pointing out my error. Everything is working fine after correcting my error.
ajith
-
AuthorPosts
- You must be logged in to reply to this topic.