I am trying to make a form to check whether the food has expired. In the form there are 2 datacard: "Has Expired" and "Expiry Date".
The "Expiry Date" datacard will be only visible if user select "Yes" for "Has Expired" datacard. This form will be submitted and the data will be stored in sharepoint list. Then, user can view the form that they have submit.
The problem I am facing is that when the user select "No", the sharepoint list still update the default date. How to make it empty?
1. I have tried to clear the date inputtextholder properties. However, this also cleared the date enter by user when they select "Yes", when they view the form.
p/s: I am still new in PowerApps. Hope the experts can help me.
Solved! Go to Solution.
I would suggest using this code in the Update property of your DataCard for ExpiryDate. When the Has Expired toggle shows "Yes" the selected expiry date will be updated in Sharepoint and when "No" the expired date will be updated as a blank field.
If( toggle_HasExpired.Value=True, DataCardValue_ExpiryDate.SelectedDate, Blank() );
Another tip: it would be a good idea only to show the Expiry Date datepicker when Has Expired is True. To do that put this code in the Visible property of the Expiry Date datacard.
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."