on 2023 Jan 20 10:14 AM
HI,
I have a segmented control with 2 values ("Partial" and "Final"). When clicking "Submit" on the page it does a CallFunction OData Action and sends data back to SAP. The CallFunction Action contains two parameters of "Partial" and "Final" which need to be either "true" or "false".
How do I say "if Partial is selected, then set Partial Flag on CallFunction Action to true" (same for Final)?
...{
"_Type": "Control.Type.FormCell.SegmentedControl",
"_Name": "FormCellSegmentedControl0",
"IsEditable": true,
"IsVisible": true,
"Caption": "Type",
"ApportionsSegmentWidthsByContent": false,
"Segments": [
"Final",
"Partial"
]
}...
Action:
..."Function": {
"Name": "Confirmation",
"Parameters": {
"Final": false, <-- I want this to be "if Final is selected, then true"
...
Thanks,
James
Request clarification before answering.
Assign a rule to the Final property in your CallFunction action. In the rule get the return value from the Segmented control and based on the value return true or false from your rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is probable that the validation error is a false positive where the validator is not detecting the value as a rule and ignoring it but rather validating that it is either a literal true or false string for the property.
I would go ahead and deploy it with the rule and test. I expect it will work correctly (assuming your rule is correct). In which case let us know and we can open a issue for the editor to enhance the validation check.
Hi Bill,
The backend still shows blank values for Final and Partial:
Is this because the values are held in a Segmented controls, and so #value has no meaning here? If so, how would I get the "selected value" (#SelectedValue??)?
EDIT: Yes, it was that. Fixed with this rule:
/**
* Describe this function...
* @param {IClientAPI} context
*/
export default function CheckFinalFlag(context) {
let oSegControl = context.evaluateTargetPath('#Page:Operation_Confirmation/#Control:FCType');
if ((oSegControl.getValue()[0].ReturnValue) === "Final") {
return true;
}
return false;
}
User | Count |
---|---|
85 | |
11 | |
8 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.