I'm new enough with collections and entities not to have a good sense of what techniques are most efficient. I have been thinking of Form as a communication vehicle to be loaded and unloaded, and a way to avoid process variables. Arrays would need to be packed and unpacked, but Example 11 on page http://doc.4d.com/4Dv17/4D/17/OB-SET.301-3730704.en.html makes me want to try using Form.CollectionName[n] too.
Keith > On Oct 2, 2018, at 4:03 PM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Keith, > Sure, if having the choice list in the data object is relevant. Depends on > how the form is set up I think. Typically I would pass a data object to a > form or subform to be populated with data or allow the user to edit it. I > make the form for a particular kind of operation. Right now I'm working on > Payments so I've got a main Payment form and a few subforms that manage > some aspect of a payment. Like credit card entry, manual entry, static > display and so on. So things like popups or combo boxes are static or > dynamic within a range and the content is determined by the kind of form. > All I care about getting into the data object is whatever choice is made. > > It sounds like you're describing a situation where the data object includes > things like the choice lists. > > It's not a case of one being better than the other, more a case of > different approaches to managing the form. > > On Tue, Oct 2, 2018 at 1:28 PM Keith Culotta via 4D_Tech < > 4d_tech@lists.4d.com> wrote: > >> or for each value of ChoicesArray: OB SET(Form;"ChoicesArray"+string($i); >> ChoicesArray{$i}) ? >> >> Keith >> >>> On Oct 2, 2018, at 3:10 PM, Keith Culotta via 4D_Tech < >> 4d_tech@lists.4d.com> wrote: >>> >>> You can save ChoicesArray to the Form object with OB SET >> ARRAY(Form;"myarr";ChoicesArray). >>> http://doc.4d.com/4Dv17/4D/17/OB-SET-ARRAY.301-3730702.en.html >>> >>> Also 'JSON Stringify array' will produce a string that can be >> reconstituted with JSON PARSE ARRAY. >>> FORM.myarr:=$stringifiedArray >>> http://doc.4d.com/4Dv17/4D/17/JSON-PARSE-ARRAY.301-3730390.en.html >>> >>> Keith - CDI >>> >>>> On Oct 2, 2018, at 2:42 PM, Chris Belanger via 4D_Tech < >> 4d_tech@lists.4d.com> wrote: >>>> >>>> I am trying to make a ComboBox object that is local to the Form. Hence >> I need the Array to be a Form. object >>>> >>>> ARRAY TEXT(Form.ChoicesArray;0) does not work; >>>> >>>> Trying to get the data into a COLLECTION and then use COLLECTION TO >> ARRAY (which should define the array easily) does not work: >>>> >>>> Form.col_UnitTypes:=ds.Unit_Type.all().orderBy("Name >> asc").toCollection("Name";dk with primary key) >>>> COLLECTION TO ARRAY(Form.col_UnitTypes;Form.box_Type_Unit;"Name") >> >>>> >>>> does not work ("4D was expecting a Variable" error). >>>> >>>> >>>> Is there now way to set up an ARRAY for Form.Array usage? >>>> >>>> Thanks for any observations, >>>> >>>> Chris >>>> ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************