How do I write a query (either a named Query or one that can be run on a rest API call) to get GD but also the most recent GH record if it has been updated within a month ?
Thanks
Best Answer
M
Matthieu DE PILLOT DE COLIGNY
said
6 months ago
Hello !
Here is an example of a simple
query that should correspond to your need.
From an entity Person (which has historization enable) I will return the ID,
first name, last name and update date, as well as the same attributes from the
GH. To add the GH in the query, you can select it via the first "add
property" button
The first way to do so is
to select the ‘Multi Records Expression’, to return a list of GH_ records
fitting the selecting parameters. Be mindful to select the relevant properties
for the historyrecords, in the 'Name and Definition' panel. In your case, the
filter should be the same as in this screenshot, to return multiple records at
most one month old
Calling that query through Rest
API give the following result:
The second way to do so is
to select ‘Value Expression’. Since it will return a value, the more efficient way is to use the ‘lookup’
function to return what’s needed from the GH_ record. In this case, the filter
isn’t in the ‘Name and Definition’ but within the lookup structure itself
Calling that query through Rest
API give the following result:
Here are the basics for your
need, but you can fine tune it by adding parameters, or changing some
properties
Have a nice day !
1 Comment
M
Matthieu DE PILLOT DE COLIGNY
said
6 months ago
Answer
Hello !
Here is an example of a simple
query that should correspond to your need.
From an entity Person (which has historization enable) I will return the ID,
first name, last name and update date, as well as the same attributes from the
GH. To add the GH in the query, you can select it via the first "add
property" button
The first way to do so is
to select the ‘Multi Records Expression’, to return a list of GH_ records
fitting the selecting parameters. Be mindful to select the relevant properties
for the historyrecords, in the 'Name and Definition' panel. In your case, the
filter should be the same as in this screenshot, to return multiple records at
most one month old
Calling that query through Rest
API give the following result:
The second way to do so is
to select ‘Value Expression’. Since it will return a value, the more efficient way is to use the ‘lookup’
function to return what’s needed from the GH_ record. In this case, the filter
isn’t in the ‘Name and Definition’ but within the lookup structure itself
Calling that query through Rest
API give the following result:
Here are the basics for your
need, but you can fine tune it by adding parameters, or changing some
properties
Max. bonnell
Hi,
How do I write a query (either a named Query or one that can be run on a rest API call) to get GD but also the most recent GH record if it has been updated within a month ?
Thanks
Hello !
Here is an example of a simple query that should correspond to your need.
From an entity Person (which has historization enable) I will return the ID, first name, last name and update date, as well as the same attributes from the GH. To add the GH in the query, you can select it via the first "add property" button
The first way to do so is to select the ‘Multi Records Expression’, to return a list of GH_ records fitting the selecting parameters. Be mindful to select the relevant properties for the historyrecords, in the 'Name and Definition' panel. In your case, the filter should be the same as in this screenshot, to return multiple records at most one month old
Calling that query through Rest API give the following result:
The second way to do so is to select ‘Value Expression’. Since it will return a value, the more efficient way is to use the ‘lookup’ function to return what’s needed from the GH_ record. In this case, the filter isn’t in the ‘Name and Definition’ but within the lookup structure itself
Calling that query through Rest API give the following result:
Here are the basics for your need, but you can fine tune it by adding parameters, or changing some properties
Have a nice day !
Matthieu DE PILLOT DE COLIGNY
Hello !
Here is an example of a simple query that should correspond to your need.
From an entity Person (which has historization enable) I will return the ID, first name, last name and update date, as well as the same attributes from the GH. To add the GH in the query, you can select it via the first "add property" button
The first way to do so is to select the ‘Multi Records Expression’, to return a list of GH_ records fitting the selecting parameters. Be mindful to select the relevant properties for the historyrecords, in the 'Name and Definition' panel. In your case, the filter should be the same as in this screenshot, to return multiple records at most one month old
Calling that query through Rest API give the following result:
The second way to do so is to select ‘Value Expression’. Since it will return a value, the more efficient way is to use the ‘lookup’ function to return what’s needed from the GH_ record. In this case, the filter isn’t in the ‘Name and Definition’ but within the lookup structure itself
Calling that query through Rest API give the following result:
Here are the basics for your need, but you can fine tune it by adding parameters, or changing some properties
Have a nice day !
1 person likes this
-
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 275 topics