i
Data Source
Access methods are used to retrieve items or access specific functionalities.
Class methods are specific to each element, facilitating their management and incorporating their own behavior.
Access Method
Name |
Description |
Result |
---|---|---|
setDataSource(idDataSource)
|
Gets a DataSource object, with the ID sent by parameter.
Parameter •String idDataSource: Datasource identifier. |
Datasource |
Class Methods
Name |
Description |
Result |
---|---|---|
afterExecute(callback) |
It is used to execute a function after invoking the Datasource.
Parameter •(data: Object?) => Object callback: Function to be invoked |
- |
createDataSource(idDatasource, executeCallback) |
It allows to create a datasource with a specific identifier. •String idDataSource: Datasource identifier •Callback executeCallback: Function to be executed upon completion of the operation Example: instances: Record<string, any>; paging?: { pages: number, "page-number": number; }; } | Record<string, any> | Record<...>[]): |
Datasource |
execute(callback, nuPage, qtRows) |
It executes a datasource and upon receiving a response from the server it calls the callback function.
Parameters •Function callback: Function to be executed upon completion of the operation •Number nuPage (optional): indicates the page to search. If not defined, it is the home page •Number qtRows (optional): Number of records to read, if not specified, will be 20
Example:
$d.getDataSource("business").afterExecute((data) => { isOwner = data.instances[0]?.owner activeButton("profileButton"); if (isOwner) { hideEditOption(true); } else { hideEditOption(false); } }); |
- |
getData() |
Gets the data from the datasource. |
Object |
getFilters() |
Gets the filters from the datasource. Gets an array of objects with code, operation, type and value. |
Array<{ code: string; type: "LITERAL" | "VARIABLE" | "PARAMETER"; operation: string[]; value: FilterValue; }>
|
getName() |
Gets the name of the datasource. |
String |
getOrder() |
Gets the object that represents the order modeled in the datasource. |
{ code: string; order: "ASC" | "DESC"; ] | null
|
getSelection() |
Gets the selected form fields or rule output parameters. |
String[] |
getSource() |
Gets the form identifier or rule name. |
String |
getType() |
Gets the type. It can be rule or form. |
String |
setFilter(code, operation, type, value) |
Sets a filter to the datasource.
Parameters •String code: Field identifier or rule or form parameter. •String | String[] | null operation (optional): Comparison operator (Logical operators). If null, the filter is cleared. •"LITERAL" | "VARIABLE" | "PARAMETER" type (Optional): Type of Operation. •Any value (Optional): Value to set
Example:
$d.getDataSource("SuccessfulPaymentInformation").setFilter("relatedSale", "eq", "LITERAL", $d.getDataSource("DigitalSale").getData()[0].procedureNumber); |
- |
setOrder(code, order) |
Sets an order to the datasource.
Parameters •String code: Field identifier or rule or form parameter. •"ASC" | "DESC" order: Indicates the type of order with which the operation will be carried out |
- |