Dynamic SemQL function to drill down entity and return a record
Cédric BLANC
started a topic
over 2 years ago
How to create dynamical SemQL function which drills down entity and returns specific record? Case: Car has always Contract. When creating Car, user chooses whether the ownership is X or Y. When user chooses ownership X, I want to choose automatically Contract Z and fill it in FID_contract field. There is only one contract (Contract Z) for ownership X and I want to get this Contract Z's UUID automatically in FID_Contract.
It is quite easy to hard code, but in the development period UUID will change.
Best Answer
C
Cédric BLANC
said
over 2 years ago
Hi Valtteri,
if my understanding is correct, Contract and Ownership are both parent entities of Car.
In this case, you could create an enricher with None as scope and trigger this enricher On Data Change during the form step. This enricher will fill FID_Contract with this kind of expression:
case when
lookup
distinct_count FID_Contract
from Ownership.Cars
end
= 1
then
lookup
first FID_Contract
from Ownership.Cars
end
end<span class="fr-marker" data-id="0" data-type="false" style="display: none; line-height: 0;"></span><span class="fr-marker" data-id="0" data-type="true" style="display: none; line-height: 0;"></span>
This means that if only one distinct Contract is associated with the selected Ownership, then we take the first one to fill current FID_Contract.
I hope this helps.
1 Comment
Cédric BLANC
said
over 2 years ago
Answer
Hi Valtteri,
if my understanding is correct, Contract and Ownership are both parent entities of Car.
In this case, you could create an enricher with None as scope and trigger this enricher On Data Change during the form step. This enricher will fill FID_Contract with this kind of expression:
case when
lookup
distinct_count FID_Contract
from Ownership.Cars
end
= 1
then
lookup
first FID_Contract
from Ownership.Cars
end
end<span class="fr-marker" data-id="0" data-type="false" style="display: none; line-height: 0;"></span><span class="fr-marker" data-id="0" data-type="true" style="display: none; line-height: 0;"></span>
This means that if only one distinct Contract is associated with the selected Ownership, then we take the first one to fill current FID_Contract.
Cédric BLANC
How to create dynamical SemQL function which drills down entity and returns specific record? Case: Car has always Contract. When creating Car, user chooses whether the ownership is X or Y. When user chooses ownership X, I want to choose automatically Contract Z and fill it in FID_contract field. There is only one contract (Contract Z) for ownership X and I want to get this Contract Z's UUID automatically in FID_Contract.
It is quite easy to hard code, but in the development period UUID will change.
Hi Valtteri,
if my understanding is correct, Contract and Ownership are both parent entities of Car.
In this case, you could create an enricher with None as scope and trigger this enricher On Data Change during the form step. This enricher will fill FID_Contract with this kind of expression:
This means that if only one distinct Contract is associated with the selected Ownership, then we take the first one to fill current FID_Contract.
I hope this helps.
Cédric BLANC
Hi Valtteri,
if my understanding is correct, Contract and Ownership are both parent entities of Car.
In this case, you could create an enricher with None as scope and trigger this enricher On Data Change during the form step. This enricher will fill FID_Contract with this kind of expression:
This means that if only one distinct Contract is associated with the selected Ownership, then we take the first one to fill current FID_Contract.
I hope this helps.
-
Extend a model with new entities or attributes
-
Data types in xDM
-
Effective date on entities
-
Search using wild cards
-
Export a model from production and import on a development environment
-
"Allow Delete" vs "Allow Removal" privileges
-
LOV label in Named Query
-
Select location on a map and save coordinates
-
Is there a way to set up a master-detail relationship on browse mode?
-
Choose Either a Stepper or A Workflow Based on The User Privileges
See all 274 topics