DonLarson
3 years agoQrew Elite
Jinja Max Value of a Field
I have a Search step that looks at all the child records for a parent.
In that Search I am collecting a single Date Time Stamp Field.
Then I am evaluating the field to get the max value using this Jinja Expression:
{{a|max(attribute='child_table_date')}}
It does work, picking the maximum value from all the fields in the child table. However I am getting much more than just a date time stamp.
--- child_table_date: 2022-11-04 00:00:00+00:00 created_at: 2022-07-26 02:40:56.063000+00:00 id: 3 last_modified_by: email: DLarson@MCFIndustries.com first_name: Don id: 56472559.bjvz last_name: Larson screen_name: DLarson_MCF record_owner: email: DLarson@MCFIndustries.com first_name: Don id: 56472559.bjvz last_name: Larson screen_name: DLarson_MCF updated_at: 2022-11-17 04:10:31.507000+00:00 ...
I hoped to only get
2022-11-04 00:00:00+00:00
which I would use for another step
Surely there is something missing from initial expression and it should not be providing everything else about the record and the value of the field.
Anyone got a suggestion?
------------------------------
Don Larson
------------------------------
In that Search I am collecting a single Date Time Stamp Field.
Then I am evaluating the field to get the max value using this Jinja Expression:
{{a|max(attribute='child_table_date')}}
It does work, picking the maximum value from all the fields in the child table. However I am getting much more than just a date time stamp.
--- child_table_date: 2022-11-04 00:00:00+00:00 created_at: 2022-07-26 02:40:56.063000+00:00 id: 3 last_modified_by: email: DLarson@MCFIndustries.com first_name: Don id: 56472559.bjvz last_name: Larson screen_name: DLarson_MCF record_owner: email: DLarson@MCFIndustries.com first_name: Don id: 56472559.bjvz last_name: Larson screen_name: DLarson_MCF updated_at: 2022-11-17 04:10:31.507000+00:00 ...
I hoped to only get
2022-11-04 00:00:00+00:00
which I would use for another step
Surely there is something missing from initial expression and it should not be providing everything else about the record and the value of the field.
Anyone got a suggestion?
------------------------------
Don Larson
------------------------------
- I believe max returns the whole object, so you would need to grab the single attribute from that object:
{{ a | max(attribute='child_table_date') | attr('child_table_date') }}
Hope that helps!
------------------------------
Doug Henning
------------------------------