Hello All,
I have created power apps form which handles Mobile purchase reimbursement requests.
But i am stuck with the load rules of the app. user submits the request from the app and request gets stored in the share point list which is working fine & Now all i want to do is when the same user opens the app it should go to the data source and check for the existing record for the user and if there is a record it should pull the Next purchase date and compare it with today's date. If the next purchase date is greater than or equal to today. It should allow him to home screen to submit the new request which should basically replace the existing record in the share point list. If the next purchase date is not lesser than today it should take him to a screen which says your next purchase date is 01/06/2022 please come back on this date.
I am calculating next purchase date using this formula - Purchase date + 2 years.
Please help me to achieve this.
Thanks,
CL
Solved! Go to Solution.
In the "App" ssection - abover your screen list in the interface - there is an OnStart property. All the commands listed there will run before anything shows in the app. If you include:
@Chiranth1992
Please share a sample of the data you are pulling from SharePoint. I need to know the column names, column types, and a few rows of sample data.
When loading the app needs to check the SP list "created by" to see if it matches the current user. Set a variable on load to the current user and use that for the search. If there is no match you could navigate to the screen to create a new request. If there is a match, filter the gallery by there user name. Check the date match and have your "Submit "button's visible property (or view property) set so that it will only work if the date is correct. You could also have a pop up message set to the same if statement.
If you just want to leave that single record you could just change the date to the current date and allow them to save it. Or you could generate a new record by copying the previous info into a new record with today's date. That way you would keep a running record of all orders.
Hi @mdevaney
Please find the column names, all the columns data type is text except PurchaseDate and NextPurchase date in the date format.
How the lookup happens if there are mutliple record for the same user.
@BrianS I am new to powerapps. It would be great if you can help in details.
as you said, Look to splist to match the current user and compare the date by filtering the gallery.
How does it work if there are multiple record for the same user ?
In the "App" ssection - abover your screen list in the interface - there is an OnStart property. All the commands listed there will run before anything shows in the app. If you include:
I followed your instruction and i was able to create reorder screen to show the list of requests from the user and if it find the record in SP for the current user it is taking me to reorder screen but here i have an issue controlling the button visibility.
I applied this formula on button visibility which i created in reorder screen to accept the new request.
Today()>=NextPurchaseDate
But problem with this formula it is taking the latest Nextpurchase date but it should pull the next purchase date from the latest record of the user and compare it with today.
Please let me know how can i achieve this.
Thanks,
CL
I'm unclear on how you are calculating these figures. I saw the field in your list called NextPurchaseDate, and assumed you were using that to hold the next date someone could purchase. If that is not the case, you will have to figure out how to derive the date. You can Set a variable in the OnSelect of the gallery to one of the fields in that record and then add time to see how it compares to today and use that to determine whether the button is Disabled or not. Make sure the data you are using in your SP list is accurate, or your testing may not show correct results
@BrianS Thank you. I was able to achieve what i wanted to do.
Thanks for the help.