Validation of a Value

Hi! 

In my project I need to make a Car's Renting Service. So, In the Renting field I need to link a Car to only one Driver, at the same time I can link a Driver to more than one car. 

Where and how can I validade this information? I was able to set the Car value to the Driver, but I couldn't validate so it would prevent the Car to have more than one Driver.

And how can I make a timeline field to register all the previous registrations instead of just refreshing the info? 

Best Regards, D.

It is a classical one to many relationship,in your table Car just create a column DriverId as a foreign key to Entity Driver.

regards

You can use aggregate inside your logic for checking between table driver and car. Just check whether the car already linked to driver or not, if the car already linked to driver then do raise exception, if empty ( not linked) then you may linked it. 

anyway its more easier if you share your oml file, so we can get more understanding about the problem and we can try to fix it. 

regards, Ran

Champion

Hey Ed

Solution for your question is more on the side of Data Modelling. You can defiantly control the assignment of Car to Driver as 1 to many relationship but what is your requirement with Timeline? Are you asking about the Passenger Registration Timeline or the  Registration of Car to Driver! In case if driver changes and you need timeline to maintain the drivers history. 

Please use the below data model structure -

Hopefully it will solve the issue. In case you have doubts in adding the logic - feel free to ask


Hi Eduarda Liberato,

By your statement you need to make one to many relationship between driver to cars than fetch the Agg. in that you check the specific car is linked or not ,there only you can raise an exception.

One-To-Many

kind regards

Sourabh

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