Hello! I need some assistance on my formula so that the correct date can be picked up from my Sharepoint List onto Power Apps.
Here’s my context: I am trying to create an app for ticket reservations, and each person can only reserve the ticket once every 2 months. Eg: If I reserve the ticket today (17/09), I can reserve a ticket that is dated 2 months from today (17/11 onwards). My formula on Power Apps would check through 2 columns from my Sharepoint List: Status (= Reserved) and Date of Visit.
Here’s my problem: My current formula can’t fulfil the condition to book once every 2 months. For eg: I first make a booking for 1 Jan 2022 and make a second booking for 1 Oct 2021. If I make a third booking for 31 Dec 2021, instead of stopping this reservation from happening since my next booking is on 1 Jan 2022, my formula would allow this reservation to be submitted instead because it is more than 2 months from 1 Oct 2021.
How should I go about refining my formula? Here's my formula:
If(And((LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,Status="Reserved") And (LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,DateofVisit)-DataCardValue22.SelectedDate)<=60),((LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,Status)="Reserved") And (DataCardValue22.SelectedDate-(LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,DateofVisit))<=60))),"You can only make a booking once in every 2 months.",""))
Have tried multiple ways but am still stuck at it. Appreciate your help, thank you!