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 3 years 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 3 years 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.
-
Recover Deleted(soft Delete) Record and Configure in Application
-
How Can I Trigger Enricher or Sql Procedure when deleting?
-
Unstructured and Semi Structured Data in Semarchy?
-
Read CSV files from AWS S3
-
Find SQL Statements Generated for Match Rules
-
Is it possible to disable specific steps of an Integration Job?
-
Reset the Override on Many Records Through the Interface or By Script
-
PL/SQL Procedure With B_CREDATE and B_UPDDATE Not Mapped or Loaded, Columns Will Be Null
-
Unable to Load Publisher Data Using Continuous Load
-
LoadDataRecord contains non persitable expressions when trying to publish Data using the Rest API
See all 61 topics