*** Updating this.
you could create a collection of that field, then read the collection and order the server module to save each record, or move that to a list before going to the server module.
a little bit of this post to create the fields and present them in the screen:
viewtopic.php?f=3&t=2427
and this example to read the collection in the server module...
https://docs.lansa.com/14/en/lansa013/c ... 6_1045.htm
I created this Web Page as example for now:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Height(465) Width(881)
Define_Com Class(#STD_NUM.Visual) Name(#STD_NUM) Caption('Number of Fields') Displayposition(1) Height(19) Labeltype(Caption) Left(24) Parent(#COM_OWNER) Tabposition(1) Top(16) Width(193) Usepicklist(False)
Define_Com Class(#PRIM_PHBN) Name(#CREATE_FIELDS) Caption('Create Fields') Displayposition(3) Left(232) Parent(#COM_OWNER) Tabposition(3) Top(16) Width(113)
Define_Com Class(#PRIM_PHBN) Name(#SAVE_FIELDS) Caption('Save Fields') Displayposition(2) Left(352) Parent(#COM_OWNER) Tabposition(2) Top(16) Width(113)
Define_Com Class(#PRIM_MD.Label) Name(#Text) Caption('Text') Displayposition(4) Left(475) Parent(#COM_OWNER) Tabposition(4) Top(15) Width(302)
* Create one collection of fields Amounts
Define_Com Class(#PRIM_KCOL<#STD_AMNT.EditField #STD_NUM>) Name(#BunchOfFields) Reference(*DYNAMIC) Style(Collection)
Evtroutine Handling(#CREATE_FIELDS.Click)
If_Ref Com(#BunchOfFields) Is_Not(*null)
Set_Ref Com(#BunchOfFields) To(*null)
Endif
* Create the collection
Set_Ref Com(#BunchOfFields) To(*Create_as #PRIM_KCOL<#STD_AMNT.EditField #STD_NUM>)
Begin_Loop Using(#std_int) To(#STD_NUM)
Set_Ref Com(#BunchOfFields<#std_int>) To(*CREATE_AS #STD_AMNT.EditField)
Set Com(#BunchOfFields<#std_int>) Width(200) Displayposition(#std_int) Tabposition(#std_int) Parent(#COM_OWNER) Height(55) Top((60 * #std_int))
End_Loop
Endroutine
Evtroutine Handling(#SAVE_FIELDS.Click)
Define_Com Class(#TEST0325sm.SaveFields) Name(#Savefields)
Define Field(#total) Reffld(#STD_AMNT)
#total := 0
For Each(#Current) In(#BunchOfFields)
#total += #Current.Value
#Savefields.ExecuteAsync Std_Amnt(#Current.Value)
Endfor
#Text.Caption := #std_num.asstring + ' fields saved totalling $' + #total.asString
Endroutine
End_Com
which calls this server module:
Still thinking in a nicer way to send the full collection to the server module... off course, one simple way (and better for performance so only one call to the server module) could be to read the collection and move it to a list, then send the list to the server module...
Code: Select all
Evtroutine Handling(#SAVE_FIELDS.Click)
Define_Com Class(#TEST0325sm.SaveList) Name(#Savefields)
Def_List Name(#ListOfAmounts) Fields(#STD_AMNT) Type(*WORKING) Entrys(*MAX)
Clr_List Named(#ListOfAmounts)
For Each(#Current) In(#BunchOfFields)
#STD_AMNT := #Current.Value
Add_Entry To_List(#ListOfAmounts)
Endfor
#Savefields.ExecuteAsync Listofamounts(#ListOfAmounts)
Endroutine
and the server module:
Code: Select all
Def_List Name(#ListOfAmounts) Fields(#STD_AMNT) Type(*WORKING) Entrys(*MAX)
Srvroutine Name(SaveList)
List_Map For(*INPUT) List(#ListOfAmounts)
Selectlist Named(#ListOfAmounts)
Insert Fields(#STD_AMNT) To_File(LISTAMNT)
Endselect
Endroutine