This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
EDIT: The problem lies with the fact that my Next_button is on the command handler. When I move next_button to the View, it works fine. However, it creates design issues (among others) if next_button's parent is not the command handler. So the basics of what I'm looking for help with is moving lists back and forth between the View and the command handler.
In the below image, I have 4 fields that have an N in them. When I click next button, I should get a #sys_web.alert that says at least 1 of them needs to be a Y. However, the list isn't read by the by the server module routine flagcheck. I even tried doing it by individual fields, but still doesn't work. Relevant code after image. I'm sure it's something simple/easy that I'm missing, so thank you.
Evtroutine Handling(#Next_Button.Click)
Inz_List Named(#flags)
#CUDTC01.flagcheck
If Cond('(#CSSTYN *EQ N) *AND (#CSBTYN *EQ N) *AND (#CSPPYN *EQ N) *AND (#CSFBYN *EQ N)')
#sys_web.Alert Caption('Ship to or Bill to has to be a Y')
All your Field_Maps for SRVROUTINE are *INPUT - meaning the routine is just reading the fields and the list. Are the Fields suppose to be output and the list input ? In other words, no variables are returned to the program from that SRVROUTINE.
That's a fair point. Unfortunately, when I get to the SRVROUTINE and it gets to "Get_Entry Number(1) From_List(#flags)" it's not reading the list, even though in debug when I click the "create" button at the top, the list is populated. Appreciate the response, thank you for your input
Is your webpage starting a session? It seems your server routine requires a session. If you are testing, try removing the "Session(*REQUIRED)" and see if it works.
Not sure if this will apply to your particular case, but if you are trying to move lists between components, defining the list as a collection instead of a normal list, helps a lot. No to much of a complication, you just need to create an object with the elements of the list, the rest is very similar.
You can create a reusable part (object type) like this and lets called it ABCITEM:
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#xDemoTheme)
Define_Com Class(#PRIM_PHBN) Name(#Showinpopup) Caption('Send the list to the view') Displayposition(1) Left(4) Parent(#COM_OWNER) Tabposition(1) Top(8) Width(133)
Define_Com Class(#PRIM_MD.ViewContainer) Name(#ViewContainer) Displayposition(2) Left(87) Parent(#COM_OWNER) Tabposition(2) Top(77)
Define_Com Class(#ABCVIEW) Name(#ABCVIEW) Height(500) Left(183) Parent(#ViewContainer) Width(550)
* Collection of items to be handled as a list
Define_Com Class(#Prim_acol<#ABCITEM>) Name(#ABCList)
Evtroutine Handling(#Com_owner.Initialize)
#com_owner.Load
Endroutine
Mthroutine Name(Load)
* Note that you populate the items in the same way
#EMPNO #SURNAME := A1111
Add_Entry To_List(#ABCList)
#EMPNO #SURNAME := A22222
Add_Entry To_List(#ABCList)
Endroutine
Evtroutine Handling(#Showinpopup.Click)
* Here you are calling a method in the VIEW and passing the list (or the reference to it)
#ABCVIEW.ShowList( #ABCList )
#ABCVIEW.Show
Endroutine
End_Com
Begin_Com Role(*EXTENDS #PRIM_VIEW) Displayposition(1) Tabposition(1)
Define_Com Class(#PRIM_LIST) Name(#List1) Displayposition(1) Height(377) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(30) Width(655) Columnlines(False) Rowlines(False)
Define_Com Class(#PRIM_LIST.String) Name(#ColumnEMPNO1) Displayposition(1) Parent(#List1) Source(#EMPNO) Columnwidth(97)
Define_Com Class(#PRIM_LIST.String) Name(#ColumnSURNAME1) Displayposition(2) Parent(#List1) Source(#SURNAME) Columnunits(Proportion)
Mthroutine Name(ShowList)
* Here is how you receive the reference (or the list)
Define_Map For(*INPUT) Class(#Prim_acol<#ABCITEM>) Name(#ABCList) Pass(*BY_REFERENCE)
* Note that you read the list in the same way
Clr_List Named(#List1)
Selectlist Named(#ABCList)
Add_Entry To_List(#List1)
Endselect
Endroutine
End_Com