ftos.data.executeDbTask
IMPORTANT!
Starting with v24.3.0, this is renamed from executeDbTask to ftos.data.executeDbTask.
Starting with v24.3.0, this is renamed from executeDbTask to ftos.data.executeDbTask.
Executes a database stored procedure that has been registered as a DB task in FintechOS Studio.
IMPORTANT!
This function works only for stored procedures in the Ebs database schema.
This function works only for stored procedures in the Ebs database schema.
This is a data service method for business service components.
Syntax
Copy
function ftos.data.executeDbTask(dBTaskName : string, parameters : any): IFtosExecuteDbTaskResult;
| Parameter | Type | Description |
|---|---|---|
dBTaskName
|
string | Name of the DB Task registered in FintechOS Studio. |
parameters
|
any | JSON object containing key-value pairs matching the names and values of the database stored procedure's input parameters. |
Return Value
Returns a IFtosExecuteDbTaskResult object containing the stored procedure's output (result set and return value). For example:
Copy
{
"Records": [
{
"Name": "mrBrown",
"FirstName": "James",
"LastName": "Brown"
},
{
"Name": "mrJDoe",
"FirstName": "Johnathan",
"LastName": "Doe"
},
{
"Name": "mrBlack",
"FirstName": "Vince",
"LastName": "Black"
}
],
"ReturnValue": 0
}
Type Aliases
Copy
{
records : any[];
returnValue : number;
}
| Property | Type | Description |
|---|---|---|
records
|
any[] | Stored procedure's result set in the form of key-value pairs that map each record's column names and values. |
returnValue
|
number | Stored procedure's return value. |
Examples
In this example:
- We execute the getUsersByName DB task.
- The database stored procedure of the DB task requires the name input parameter.
- We provide a pattern for the input parameter that matches all the values that start with mr. The stored procedure uses the LIKE operator to search for the pattern we provide in the input parameter.
- We use the records property to extract the result set from the stored procedure's output and we store it in the leagueOfExtraordinaryGentlemen variable.
Copy
var leagueOfExtraordinaryGentlemen = ftos.data.executeDbTask('getUsersByName', {'name': 'mr%'}).records;