I am trying to create a dynamic picklist that needs to be linked to other dynamic list.
I tried to follow the guidance from the documentation: https://docs.lansa.com/15/en/lansa013/i ... 3_0460.htm
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_dc.iDynamicPicklist #Prim_dc.iMonitorSubject)
Def_List Name(#CXP10List) Fields(#TXBC10 #TXBD10) Counter(#ListCount) Type(*WORKING) Entrys(*MAX)
Mthroutine Name(Load) Options(*REDEFINE)
Define_Com Class(#KF002_CXP10_ServerModule.BuildPicklist) Name(#BuildPicklist)
#CONO10 := 'XX'
#BuildPicklist.execute( #CONO10 #CXP10List )
#Picklist.RemoveAll
Selectlist Named(#CXP10List)
#Picklist.add( #TXBC10 #TXBD10 )
Endselect
Endroutine
Mthroutine Name(ApplyMonitoredValue) Options(*REDEFINE)
#TXBC10 := #MonitorSubject.GetValue
Endroutine
End_Com
However I am getting an error message "GetValue is not supported on the Web"" for the line:
#TXBC10 := #MonitorSubject.GetValue
Am I missing something? Or, what should I use for a Web application to achieve the same goal?
TIA.
Linking Multiple Visualizations
Re: Linking Multiple Visualizations
Hi
While MonitorSubject.GetValue is currently not supported for web and also there is no way to request the rebuild of the picklist on the fly, an alternative solution, still using visualizations could be making a more complete visualization for that field, using a VisualPart.
For example, I can have a visualization for the SECTION field, that includes a couple of dropdowns, so you can pick the department and section and return both values:
for this effect, I created my own MYDEP and MYSEC fields so no affect the original demonstration files, then created ONE VisualPart reusable part called MYSECVIS2 with a code like this with TWO dropdowns:
and this code (you can put that code in a template later on to reuse for other pair of fields and generate it quicker next time):
and associated this visualpart to the field as a visualization:
As you already figured it out, we cannot return two values in one visualization.
But because is web, an easy solution is to use for example the sessionstorage to exchange other information, and you can see that in the code of the visualpart and in the next web page using this visualization:
and that is an idea, I would like to keep my field visualizations in the repository, saying so, other ways to achieve this will be using reusable parts and recover the values from them, you just need to be aware that such reusable part exist and use when needed.
While MonitorSubject.GetValue is currently not supported for web and also there is no way to request the rebuild of the picklist on the fly, an alternative solution, still using visualizations could be making a more complete visualization for that field, using a VisualPart.
For example, I can have a visualization for the SECTION field, that includes a couple of dropdowns, so you can pick the department and section and return both values:
for this effect, I created my own MYDEP and MYSEC fields so no affect the original demonstration files, then created ONE VisualPart reusable part called MYSECVIS2 with a code like this with TWO dropdowns:
and this code (you can put that code in a template later on to reuse for other pair of fields and generate it quicker next time):
Code: Select all
Function Options(*Direct)
Begin_Com Role(*EXTENDS #PRIM_PANL *implements #Prim_dc.iMonitorSubject) Defaultpty(Value) DisplayPosition(1) Height(193) TabPosition(1) Left(0) Top(0) Width(321) LayoutManager(#Layout)
Define_Com Class(#PRIM_TBLO) Name(#Layout)
Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutColumn1) DisplayPosition(1) Parent(#Layout)
Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutRow1) DisplayPosition(1) Parent(#Layout)
Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutRow2) DisplayPosition(2) Parent(#Layout)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem1) Manage(#DepDropDown) Parent(#Layout) Row(#LayoutRow1) Column(#LayoutColumn1) MarginBottom(5) MarginLeft(5) MarginRight(5) MarginTop(5)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem2) Manage(#SecDropDown) Parent(#Layout) Row(#LayoutRow2) Column(#LayoutColumn1) MarginBottom(5) MarginLeft(5) MarginRight(5) MarginTop(5)
Define_Com Class(#PRIM_MD.Dropdown) Name(#DepDropDown) Caption('Department') DisplayPosition(1) Parent(#COM_OWNER) TabPosition(1) Height(87) Width(311) Left(5) Top(5)
Define_Com Class(#PRIM_MD.Dropdown) Name(#SecDropDown) Caption('Section') DisplayPosition(2) Left(5) Parent(#COM_OWNER) TabPosition(2) Top(102) Height(86) Width(311)
Def_List Name(#DEPTABList) Fields(#DEPTMENT #DEPTDESC) Type(*Working) Entrys(*Max)
Def_List Name(#SECTABList) Fields(#SECTION #SECDESC) Type(*Working) Entrys(*Max)
Define_Pty Name(Value) Get(GetPropertyValue) Set(SetPropertyValue)
Evtroutine Handling(#COM_OWNER.Initialize)
#MYDEP #MYSEC := ""
#COM_OWNER.Load
Endroutine
Ptyroutine Name(GetPropertyValue)
Define_Map For(*Output) Class(#prim_alph) Name(#Property)
#Property := #MYSEC
* Plus Department:
If (#sys_web.LocalStorage<"MYDEP"> *Is *null)
#MYDEP := ""
Else
#MYDEP := #Sys_web.SessionStorage<"MYDEP">
Endif
Endroutine
Ptyroutine Name(SetPropertyValue)
Define_Map For(*Input) Class(#prim_alph) Name(#Property)
#MYSEC := #Property
Endroutine
Mthroutine Name(Load)
Define_Com Class(#DEPTABSM.FindAll) Name(#DEPTABFindall)
Define_Com Class(#SECTABSM.FindAll) Name(#SECTABFindall)
#DEPTABFindall.Execute DEPTABList(#DEPTABList)
#DepDropDown.Items.RemoveAll
Selectlist Named(#DEPTABList)
#DepDropDown.Items.Add Caption(#DEPTDESC) Value(#DEPTMENT)
Endselect
#DepDropDown := #MYDEP
#SECTABFindall.Execute SECTABList(#SECTABList) DEPTMENT(#MYDEP)
#MYSEC := ""
#SecDropDown.Items.RemoveAll
If (#MYDEP <> "")
Selectlist Named(#SECTABList)
#SecDropDown.Items.Add Caption(#SECDESC) Value(#SECTION)
Endselect
Endif
Endroutine
Evtroutine Handling(#DepDropDown.Changed)
#MYDEP := #DepDropDown
#sys_web.SessionStorage.Add Key("MYDEP") Value(#MYDEP)
#COM_OWNER.Load
Signal Event(ValueChanged)
Endroutine
Evtroutine Handling(#SecDropDown.Changed)
#MYSEC := #SecDropDown
Signal Event(ValueChanged)
Endroutine
End_Com
But because is web, an easy solution is to use for example the sessionstorage to exchange other information, and you can see that in the code of the visualpart and in the next web page using this visualization:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#MYSEC.VisualPart) Name(#MYSEC) Left(50) Parent(#COM_OWNER) TabStop(False) Top(43)
Define_Com Class(#PRIM_MD.Label) Name(#Text) Caption('Text') DisplayPosition(2) Left(48) Parent(#COM_OWNER) TabPosition(2) Top(256) Width(898)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button) Caption('What are the values of MYDEP and MYSEC?') DisplayPosition(3) Left(48) Parent(#COM_OWNER) TabPosition(3) ThemeDrawStyle('MediumTitle+Rounded') Top(200) Width(322)
Evtroutine Handling(#Button.Click)
#MYDEP := #Sys_web.SessionStorage.Item<"MYDEP">
#Text.Caption := 'Department is ' + #MYDEP + ' and Section is ' + #MYSEC
Endroutine
End_Com
-
alphabeta13
- Posts: 21
- Joined: Tue Jan 14, 2020 12:18 am
Re: Linking Multiple Visualizations
Thanks Dino, I will take a look.