Skip to main content

Calculated Date Ranges

Using a calculated date range field and gremlin to return a date range automatically

Kristine Marhilevica avatar
Written by Kristine Marhilevica
Updated over a week ago

1. Create a new field, and select Date range as the type
​

2. Select Gremlin query as the transformation

3. Input the query for the start date

//Example: get referenced component date fields 
//this gets the min value of the start dates

g.V(ids).where(__.in('Realizes').has('active_period_start_date')). project('id', 'name', 'value').
by(id).
by('name').
by(__.in('Realizes').has('active_period_start_date').order(). by('active_period_start_date', desc).limit(1).
values('active_period_start_date'))

4. Input the query for the end date

//Example: this one gets the max value of the end dates 
g.V(ids).where(__.in('Realizes').has('active_period_end_date')). project('id', 'name', 'value').
by(id).
by('name').
by(__.in('Realizes').has('active_period_end_date').order(). by('active_period_end_date', desc).limit(1). values('active_period_end_date'))

5. Apply and Save

Select the component types and/or reference types to apply this field to and Save.

Did this answer your question?