Record Exists In The DataBase

Hi,

I have an Appointments form where users can input a date and time, in my case

When a user inputs  date and time that already exists in the database the form should be invalid.(date conflict)

I have tried this solution but it did not work for me : https://www.outsystems.com/forums/discussion/59181/checking-whether-an-existing-record-exists-in-database/

Solution

The solution is right, but you need to adapt it for your use case.

First, there is one question that I need to ask if you want to check for that user if he has any record for that input date and time.

If yes, you will need to check that by creating a server action, using an aggregate you will filter by the user date. And you will check for the attribute date and time if is equal to the input that the user inserted.

Example: 

1- Create an action for the on change event on the input

2- Creat Server action

3-Push the entity


4 Put the filters on the aggregate

5- Creat an output to say if the aggreta is empty or not with the filters



6-Push the server action to the client action from the on change event on the input


7-And pass the values to the inputs of the server action


8- And pass the validation message saying that there is already the same date-time

And with this logic it will return a message

And if you want to clean the variable don't forget about putting this assign


Check the OML


CheckDateAndTime.oml

How to get the input that the user inserted? (Form.InputVariable ) does not exist in reactive.

It depends on what you are using, by using a variable that the input has or by giving the DateTime attribute from the aggregate.

You will get the value from the variable on the input

Thank You So Much Márcio!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.