Adding parameter to ZEN dataCombo at runtime from server
Hi,
I try to programmatically create a parameter for a dataCombo ZEN Component (which is in turn created on the server side at runtime).
Set tParm = ##class(%ZEN.Auxiliary.parameter).%New()
Set tParm.id = "pRegion#"_pExamContainerCount, tParm.name = "pRegion#"_pExamContainerCount
Set tExam = ##class(%ZEN.Component.dataCombo).%New()
Set tExam.id = "Exam#"_pExamContainerCount, tExam.label = "Untersuchung", tExam.queryClass = "Inventory.ServiceCatalog", tExam.queryName = "QGetExaminations", tExam.showEmpty = "false", tExam.size = "52", tExam.onchange = "zenPage.updateExamDescription(zenThis.getValue());"
//Do tExam.parameters.SetAt(tParm, 1)
// add tExam to page...
Since the parameter need to be added to the Exam dataCombo I tried to use tExam.parameters.SetAt(tParm, 1) which fails at runtime with Error Collection property is not part of the page model.
I am not sure if my approach is correct. Does this anyone before? I would appreaciate any suggestions.
Best regards,
Sebastian
Hi Sebastian,
Sorry this went unanswered for so long. In case you haven't figured it out yet, one solution is:
%AddComponent registers the parameter with the page, so you won't get that error. (There might be a better way to do this, but %AddComponent at least seems to work.)
Here's a full example:
Hi Timothy,
in fact I stumbled upon an old ZEN google groups post addressing this point just this morning. %AddComponent works for me as well. Anyway I was not able to post this fact yet :) Thank you for the response, maybe someone looking for this problem in the future.
Best regards,
Sebastian