Start a new topic
Answered

Query GD and GH

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 


Best 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

image

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

image


Calling that query through Rest API give the following result:

image


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

image


Calling that query through Rest API give the following result: 

image


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

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

image

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

image


Calling that query through Rest API give the following result:

image


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

image


Calling that query through Rest API give the following result: 

image


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
Login to post a comment