Valid if session count

Hey everyone,

Im running into some trouble with a valid if statement.

I have three columns that count the number of rows a client is assigned an attended, cancelled, or scheduled status.

I thought it would be a good idea to use these numbers in combination with an authorised sessions column to determine whether a client would be overtreated furthermore stopping a booking if the client could potentially be overtreated.

Im currently using this formula to stop any sessions from being created

[Ref].[Attended Sessions Count] + [Ref].[Scheduled Sessions Count] < [Ref].[Authorised Sessions])

This works until i hit the scenario if the client has attended all allocated authorised sessions and then i need to go back to edit that last session. For some reason it thinks that i will be creating another session when in fact i will only be editing it. Does anyone have any ideas as a workaround for this situation.

Kind Regards
Ben

1 Like

If I have understood your requirement correctly, please try a valid_if expression something like below

IF( IN([_THISROW].[Child Table Key], [Ref].[Related Children Record Column in Parent]), TRUE,
(([Ref].[Attended Sessions Count] + [Ref].[Scheduled Sessions Count]) < [Ref].[Authorised Sessions])
)

2 Likes

Nice one! I would make the following mod:

OR(
  IN([Child Table Key], [Ref].[Related Children Record Column in Parent]),
  ([Ref].[Attended Sessions Count] + [Ref].[Scheduled Sessions Count]) < [Ref].[Authorised Sessions]
)
  • the [_thisrow].[Child Table Key] doesn’t need the [_thisrow]. part
    • when you write something out like [This Column], you’re calling a value inside the row itself already.
4 Likes

Ahhh, thanks so much guys, that really did the job. :smile:

2 Likes