docs.intersystems.com
MultiValue Quick Start Tutorial
Add the MVBasic Code
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Search:    

The next step is to create the Search method. Before coding the method, set the value of the language keyword for the class to mvbasic. Change the class declaration for Services to the following:

Class MVFILE.Services Extends %SOAP.WebService 
[language=mvbasic, ProcedureBlock ]
 
Note that at this stage the class does not compile. In order to compile you must replace the Quit statement in Search with a RETURN statement.
Next, add three arguments to the method's argument list. The method declaration looks like this.
Method Search(ID As %String, ATTRNAME As %String, VNO As %String) 
As %String [ WebMethod ]
Note the following about the method declaration:
Finally, add the body to the method:
Method Search(ID As %String, ATTRNAME As %String, VNO As %String) 
As %String [ WebMethod ]
{
OPEN "DICT", "PERSON" ELSE RETURN "DICT Not Open"
READV ATTR.AMC FROM ATTRNAME,2
OPEN "PERSON" TO PERSFILE ELSE RETURN "File Not Open"
READV ATTR FROM PERSFILE,ID, ATTR.AMC
VM=CHAR(253)
VALUE = FIELD(ATTR,VM,VNO)
RETURN VALUE
}
The method returns the specified attribute value (or subvalue) of the specified MVFILE.PERSON record.


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA