pp108 : setMethodRequest()

setMethodRequest()


It sets the provided request to the model. If the model requires navigational methods that is Next and Previous methods, then those methods can be set by passing the type of method as a parameter.

Syntax

Script

modelID.setMethodRequest(oRequest, sMethodType)

Parameters

Parameter

Description

oRequest

Document object that denotes the request set for the method of the model dataset.

sMethodType

String that denotes the type of the method for which the request is set. It can be Get, Next, or Previous. The default value is Get. The Next and Previous method types are not available for non-transactional models.

Return Value


No value is returned.

Remarks


The setGetDatasetRequest() , setNextDatasetRequest() , and setPreviousDatasetRequest() methods have been deprecated. The setMethodRequest() method can be used to set the requests for all those methods.

The request being passed must contain theSOAP:Envelopetag.

Sample Codes

<xml id="request">
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP:Body>
            <GetEmployees xmlns="http://schemas.cordys.com/1.0/demo/northwind">
                <cursor numRows="5"/>
                <fromEmployeeID>1</fromEmployeeID>
                <toEmployeeID>3</toEmployeeID>
            </GetEmployees>
        </SOAP:Body>
    </SOAP:Envelope>
</xml>


This sample code demonstrates how the method can be used.

//This is done in init-done event which contains the onselect of the application
var data = cordys.selectXMLNode( event.applicationDefinition,".//*[local-name()='data']");

//The Document of the request XML should be passed as the parameter for the setMethodRequest.
employeesRequest = request.XMLDocument;

//Create instance and model
var newInstance = WebForm.getInstance("", "http://schemas.cordys.com/Employees","Employees", application);
var newModel = WebForm.getModel(newInstance, "EmployeesModel");

//Set and fire request
newModel.setMethodRequest(employeesRequest, "get");
newModel.getDataset();

Applies to


Model

Related reference

reset()
Retrieving Data For Models
Model
Get Method Name
getMethodRequest()
Next Method Name
Previous Method Name