Folks, I am racking my brain with this one, I am hoping a power apps master can help. I am designing a interview questioning app. This will take 38 questions from 10 different categories, randomly select a question from each category and then randomly select 6 of those. That part is fine.
The tricky bit is that we have to have two interviewers see the same questions in the same order in the app. The current solution is Onselect at the start;
- Builds the list of questions into a temporary collection.
- Runs an if statement to see if the candidate ID has been previously assigned for the same date -If yes, pull those questions (however they are currently not in the right order and cannot get them into it) -If No, place the generated collection into a share point list for retrieval later.
The reason for the storage is to that randomisation triggers inside the app, but the second assessor, when they log in and enter the candidate ID, will have the same set of questions.
The solutions behaviour at the moment is first hit or miss, some time the collection doesn't apply, and secondly, it will not received the order id from the storage which means we can pull the questions, but they are not in the right order.
The dataset used thus are are:
A static excel list of questions indexed by a unique ID
Question_ID, the Question itself and theValuebeing testedA temporary collection
Temp_Qthat eventually becomesTemp_Q_OrderedA shareppint list
Candidate_Q_ID_Storagethat contains theCandidate_ID,Session_date,Order_IF, andQuestion_ID
This is the current code and a link to some dummy data in the same format that I am using. I am happy to give as much as I can if it will help. I am hoping it is an obivous logic problem.
//Clear existing Collection
Clear(Temp_Q);
Clear(Temp_Q_Sorted;
Clear(Temp_Q_Ordered);
//Build Collection
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Analyse Critically")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Collaborative")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Deliver,Support, Inspire")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Emotionally Aware")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Impartiality")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Integrity")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Open-Minded")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Ownership")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Public Service")),1));
Collect(Temp_Q,FirstN(Shuffle(Filter(Question_Set,Value = "Transparency")),1));
//Get list of 6 questions
ClearCollect(
Temp_Q_Sorted,
FirstN(Shuffle(Temp_Q),6));
// Add in the mandatory diversity question
Collect(Temp_Q_Sorted,FirstN(Shuffle(Diversity),1));
// Create row number index
ForAll (Temp_Q_Sorted,
Collect(Temp_Q_Ordered,
Last(FirstN(AddColumns(Temp_Q_Sorted, "RowNumber", CountRows(Temp_Q_Ordered)+1),
CountRows(Temp_Q_Ordered)+1
)
)
)
)
//Where things get iffy (pardon the pun)
If(And(Assessing_Text.Text in Candidate_Q_ID_Storage.Title, Today() in Candidate_Q_ID_Storage.Session_Date),
ClearCollect(Temp_Q_Ordered,
Filter(Question_Set,
Question_ID in
Filter
(Candidate_Q_ID_Storage,
Assessing_Text.Text = Title && Today() = Session_Date
).Question_ID));
// Where is where I cannot get the order to stay the same, I have tried to call the column from retrieval into the new set, but to no avail.
,
ForAll(Temp_Q_Ordered,Patch(Candidate_Q_ID_Storage, Defaults(Candidate_Q_ID_Storage),
{Title: Assessing_Text.Text,
Session_Date: Today(),
Question_ID:Question_ID,
Order_ID:RowNumber}))
)