Calendar Valid_if issues

Hi,
I've created a reservation app and added a valid if constraint as follows. 

AND(
[Start] < [End],
ISBLANK(
FILTER(
"Room Booking",
AND(
[Room].[ID] = [_THISROW].[Room].[ID],
[Start] < [_THISROW].[End],
[_THISROW].[Start] < [End]
)))) 

it worked like a charm but then i realized i have a problem where everytime i tried to amend a current entry (existing), the app denied the amendment saying that there's already a reservation made for that particular date. 

What's the workaround? Appreciate the help in advance, thanks.

 

Save.png

Solved Solved
0 2 74
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

what about:

 

AND(
  [Start] < [End],
  ISBLANK(
    FILTER(
      "Room Booking",
      AND(
        [Room].[ID] = [_THISROW].[Room].[ID],
        [Start] < [_THISROW].[End],
        [_THISROW].[Start] < [End]
        [keyColumnOfYourTableRoomBooking]<>[_THISROW]
      )
    )
  )
) 

or

AND(
  [Start] < [End],
  ISBLANK(
    FILTER(
      "Room Booking",
      AND(
        [Room].[ID] = [_THISROW].[Room].[ID],
        [Start] < [_THISROW].[End],
        [_THISROW].[Start] < [End]
        [_ROWNUMBER]<>[_THISROW].[_ROWNUMBER]
      )
    )
  )
) 

 

View solution in original post

2 REPLIES 2

Aurelien
Google Developer Expert
Google Developer Expert

what about:

 

AND(
  [Start] < [End],
  ISBLANK(
    FILTER(
      "Room Booking",
      AND(
        [Room].[ID] = [_THISROW].[Room].[ID],
        [Start] < [_THISROW].[End],
        [_THISROW].[Start] < [End]
        [keyColumnOfYourTableRoomBooking]<>[_THISROW]
      )
    )
  )
) 

or

AND(
  [Start] < [End],
  ISBLANK(
    FILTER(
      "Room Booking",
      AND(
        [Room].[ID] = [_THISROW].[Room].[ID],
        [Start] < [_THISROW].[End],
        [_THISROW].[Start] < [End]
        [_ROWNUMBER]<>[_THISROW].[_ROWNUMBER]
      )
    )
  )
) 

 

Thank you! that worked liked a charm. I'm using the second one but i believe the first one should work. 

Have a good day ahead!

Top Labels in this Space