Hi,
In a screen there are 10 questions, and user will select, Yes or No radio buttons. Upon clicking on submit button, coverages associated to the questions should be shown in the next screen based on configuration table.
Coverages are based on scenarios like, show Coverage4 if Q1 is Yes and Q2 is No. So created a configuration table accordingly like below:
Configuration table:
| SCN-1 | Q1 | Yes | Cov4 |
| SCN-1 | Q2 | No | Cov4 |
| SCN-2 | Q2 | Yes | Cov5 |
| SCN-2 | Q3 | No | Cov5 |
| SCN-3 | Q3 | Yes | Cov6 |
| SCN-4 | Q4 | Yes | Cov7 |
| SCN-4 | Q5 | Yes | Cov7 |
Implementation: On App Start, created a collection to hold the configuration table.
ClearCollect(configTable, ConfigurationTables);
ClearCollect(uniqueScenariosColl, Distinct(configTable,Scenarios));
uniqueScenarioColl = ["SCN-1","SCN-2","SCN-3",...........]
Now on click on submit button, saved user's response in collection like below:
userResponseCol = [{q="Q01",r="Yes"},{q="Q02",r="No"},{q="Q03",r="No"}]
I am not able to merge the below two ForAll conditions. logic is loop all scenarios, get first scenario conditions, here Q1 is Yes and Q2 is No, check if two records are in userResponseColl, only then add the Cov4 to the finalCoverageCollection, then check second scenario and go on..
ForAll(uniqueScenariosColl,Collect(scenarioColl,Filter(configTable,Scenarios=Value)));
ForAll(scenarioColl,ForAll(userResponseCol, If(ThisRecord.q= QuestionId And ThisRecord.r = Response,Collect(matchColl,CoverageId))));
If(CountRows(matchColl) = CountRows(scenarioColl),Collect(finalCoverageCollection,matchColl));
Clear(scenarioColl); Clear(matchColl);
Appreciate your help here.