I have an entity called account in oneToMany relationship with an entity Contact. Each account has about 3 contacts. The contact table has a field called typeContact which is a list of values containing all possible types ('accountant', 'adminstrator',....).
Each account must have only one accountant. I wanted to add a validation rule, to check each time if we have an accountant or not. I started by creating a function in the database that returns a boolean, and adding it as a validation rule, but that didn't work. Can you please help me?
Thank you
Best Answer
S
Stéphanie FOURRIER
said
about 1 year ago
Hi Ziyad,
you don't need to create a custom database function for your needs.
Our semQL language provides a lookup syntax that can access children's records and calculate accordingly, like a group by would do in SQL.
For your specific case, you have to create a validation rule on the parent entity that will have this kind of expression:
lookup
count
from Contacts
where TypeContact='Accountant'
end
=
1
I hope this helps.
Best regards,
Stéphanie.
1 Comment
S
Stéphanie FOURRIER
said
about 1 year ago
Answer
Hi Ziyad,
you don't need to create a custom database function for your needs.
Our semQL language provides a lookup syntax that can access children's records and calculate accordingly, like a group by would do in SQL.
For your specific case, you have to create a validation rule on the parent entity that will have this kind of expression:
lookup
count
from Contacts
where TypeContact='Accountant'
end
=
1
Ziyad. harroud
Hello,
I have an entity called account in oneToMany relationship with an entity Contact. Each account has about 3 contacts. The contact table has a field called typeContact which is a list of values containing all possible types ('accountant', 'adminstrator',....).
Each account must have only one accountant. I wanted to add a validation rule, to check each time if we have an accountant or not. I started by creating a function in the database that returns a boolean, and adding it as a validation rule, but that didn't work. Can you please help me?
Thank you
Hi Ziyad,
you don't need to create a custom database function for your needs.
Our semQL language provides a lookup syntax that can access children's records and calculate accordingly, like a group by would do in SQL.
For your specific case, you have to create a validation rule on the parent entity that will have this kind of expression:
I hope this helps.
Best regards,
Stéphanie.
Stéphanie FOURRIER
Hi Ziyad,
you don't need to create a custom database function for your needs.
Our semQL language provides a lookup syntax that can access children's records and calculate accordingly, like a group by would do in SQL.
For your specific case, you have to create a validation rule on the parent entity that will have this kind of expression:
I hope this helps.
Best regards,
Stéphanie.
-
Import Data Into Entities via Azure Data Lake
-
Recover Deleted(soft Delete) Record and Configure in Application
-
Data Quality in batch mode and real-time integration
-
Integration with analytics tools
-
Query/Load/Delete data with the REST API
-
Does the Done Tab in Inbox have a limit?
-
How Can I Trigger Enricher or Sql Procedure when deleting?
-
Matching Rules But Only The Latest Record Creates a Golden Record
-
Unstructured and Semi Structured Data in Semarchy?
-
Read CSV files from AWS S3
See all 72 topics