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."
None of these answers worked for me and I really did not want to recreate the date columns in separate text columns.
I had to use this formula on the submit button:
SubmitForm(Form1); If(Or(IsBlankOrError(DataCardValue8.SelectedDate), IsBlankOrError(DataCardValue9.SelectedDate)), RecordsRetentionSetNullDates.Run(RecordsRetentionList.Selected.ID, IsBlank(DataCardValue8.SelectedDate), IsBlank(DataCardValue9.SelectedDate)), "");
And set up a corresponding flow to input those null values in the date fields.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!