I have a situation where my app works perfectly when I run it in the design studio however, when I run the published app, it gives an odd behaviour where the radio buttons keep the previously displayed value despite resetting them.
On a specific screen, I use radio buttons where users can provide a response to a question. The options presented vary based on the question number. Basically, if the question is C5 or I2, it presents: Yes, No and N/A. For all other questions, it only presents: Yes or N/A.
In the Items section, I have the code below.
If(ThisItem.Question.Value = "C5 - Engineering" || ThisItem.Question.Value = "I2 - Engineering", ["Yes","No","N/A"],["Yes","N/A"])
For OnSelect I have
UpdateContext({varRadioAnswerChoice: Radio2.Selected.Value});
UpdateContext({ConfirmationPopup: true})
For OnChange I have
UpdateContext({varRadioAnswerChoice:Radio2.Selected.Value})
Now, If the question has already been answered (the items Status is set to 'completed'), I pull the Answer value from SharePoint and display that, otherwise the Radio buttons should not have anything selected. To do this, in Default, I have
If(
ThisItem.Status.Value = "Completed",
ThisItem.Answer.Value,
Blank()
)
If I open an item where the status is 'completed', the answer in SharePoint is displayed correctly, the form is 'read only' and the save button is disabled, so users can only select the 'back' button. The OnSelect value of the back button is
//Clear the Radio button variable
UpdateContext({varRadioAnswerChoice: Blank()});
//Clear the Radio buttons
Set(
IsReset,
true
);
Set(
IsReset,
false
)
This should clear the radio buttons so that when the user selects another item, it uses the 'Default' option below to either show the selected items saved value if complete or blank if not complete.
If(
ThisItem.Status.Value = "Completed",
ThisItem.Answer.Value,
Blank()
)
In the Dev Studio, when I test this with the following steps, it works perfectly every time:
However, after publishing it, when I follow the above steps in the published app, for step 3, it displays the radio button option from the previously completed question rather than no values.
Shows this:
Should be showing this:
If I then click on the back button again, If I watch closely, I can see the radio button clear and then if I then go in to a question that is not completed, it works correctly.
I thought there might be a delay in the changes being published but I left it over the weekend and it is still gives this behaviour in the published app. I've tried different browsers and colleagues see the same behaviour.
What am I missing here?
Thanks
Paolo
Let's cover some generic "dev studio versus play mode" points first -- Do you have any parameters being passed into the app which maybe aren't being initialized/set properly? Have you tried using the monitoring tool with someone playing the published app to see if there are errors being thrown?
As for the app content itself, it sounds like you have a gallery of SharePoint items (questions?) on one screen, with radio buttons for one of the columns using some conditional logic to control their labels and default values. The selected gallery item populates a form on another screen. Do you ever patch the changes made in the app back to the SharePoint list? If you aren't, then reloading the gallery screen is showing the original data from SharePoint.
I'm not sure how i can reset ThisItem. When i click the back button, it reloads the gallery and when i click on the arrow to go to the next screen ThisItem.Status.Value should be pulled from the new record i select. The rest of the data is displayed correctly.
In a DataCard on a form, ThisItem is referring to the form's Item property that populates the specific record, so it would be referring to the row in the gallery when you first selected it.
You can reset the form to its default state (which will pull the updated gallery item) with ResetForm(FormName), such as with a button press or OnVisible of the screen, for example.
Hi @RMCoder
Thanks for the suggestion. I have tried using Reset(Radio2) which does clear the radio buttons BUT gives the following message in a red banner at the top "the reset function can only be used with a resettable control. Controls within a form or Gallery can only be reset from within the same form or gallery template".
I've also tried using ResetForm(myFormname) but this doesn't work in the published app. No error but the radio buttons don't clear.
I'm not sure how i can reset ThisItem. When i click the back button, it reloads the gallery and when i click on the arrow to go to the next screen ThisItem.Status.Value should be pulled from the new record i select. The rest of the data is displayed correctly.
My issue seems to be that I can make everything work consistently in the Dev Studio but it simply doesn't work correctly in the live app.
Just a thought, but when you click the back button, do you ever reset what ThisItem refers to in your app?
Your Default logic is relying on ThisItem, so when you reset the radio button with ThisItem.Status.Value still equal to 'Completed', you get the existing/previous answer.
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
MS.Ragavendar
72