a month ago
Hi All!
I am having trouble understanding, and gaining access to the values within object tables. My current project uses a 'checklist' which uses the object table as its main component, and each 'item' in the checklist has a boolean field in its ODATA called 'isMandatory'.
Ultimately, I need to be able to submit this checklist using a submit button at the bottom of the page, ONLY IF all items that are Mandatory have been populated. I just have no idea how to access those values...
I have attached a text file with the page structure taken. Currently, the 'isMandatory' value is being held in the statusText field.
Any help would be greatly appreciated!
Here is an example of calling read with a filter and looping over the results.
export default function ValidateItems(context) {
let pageProxy = context.getPageProxy();
let clientData = pageProxy.getClientData();
var valid = true;
return context.read('/MDKApp/Services/Sample.service', 'MyEntitySet', [], `$filter=isMandatory eq 'X'`).then((results) => {
if (results) {
for (let i = 0; i < results.length; i++) {
let item = results.getItem(i);
// Validate item properties are set, can do as a single check or by muiltiple checks on the item
if (item.prop1 && item.prop2) {
valid = true;
} else {
valid = false;
// Display an error message? and quit loop?
}
}
return valid;
}
});
}
The example is for the validation check is just a simple check. You can expand that based on your requirements and decide what you want to do when a validation failure occurs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.