Hieu Dien Nguyen · Aug 23, 2018 go to post

Actually I need cursors to do some more complex tasks but I can't show the source code of the company's project here, so just edit a bit to post in this topic. But thanks for your recomment smiley

Hieu Dien Nguyen · Aug 23, 2018 go to post

I just want to make a select box in setting of business service in production. Example, if I set value the same below it will have result look like image

Property PrdType As %String(DISPLAYLIST = ",Type 1,Type 2,Type 3", VALUELIST = ",T1,T2,T3");Parameter SETTINGS = "PrdType:Basic";

So I would like to use a method, classmethod or param replace string in DISPLAYLIST and VALUELIST

Hieu Dien Nguyen · Aug 23, 2018 go to post

First, I thanks so much for your help  Eduard Lebedyuk, I make a code the same below Classmethod and succeed get sql data to Setting.  But I have a new issue, DISPLAYLIST and VALUELIST (label and value of select box in setting) have the same value. Do you know some way to set different value to label and value of select box? example: DISPLAYLIST = TypeName and VALUELIST = TypeId.

Here my ClassMethod:

ClassMethod GetPrdType(Output pCaption As %String, Output pTopResults, Output pResults, ByRef pParms As %String, pSearchKey As %String = "") As %Status{set tStatus = $$$OKkill pResults, pTopResultsset pCaption = ""set tStatement = ##class(%SQL.Statement).%New()set strSQL="SELECT TypeId,TypeName FROM Demo_Data.PrdType"set tStatus = tStatement.%Prepare(strSQL)if tStatus '= 1 Quit $$$ERROR($$$GeneralError, "No SQL Tables found")set rset = tStatement.%Execute()while rset.%Next(.tStatus) {set pResults($i(pResults)) = rset.%Get("TypeName")}quit tStatus}