Forum Discussion

CharlesDulaney's avatar
CharlesDulaney
Qrew Trainee
2 years ago

Jinja Expression for Duration (Days) > 100

Working a seeming simple pipeline to search casework, where [case age] is greater than 100 days. [case age] is a duration between two dates expressed in Days.

In the pipeline, when querying the search records

The results are much more than expected. When reviewing the pipeline activity logs, I can see the case_age is not in the same format as 123 Days.

logs show -
status:"O-In-Progress"
case_age:108862912
Clearly, pipelines doesn't recognized duration values as simple numerical values.
I cannot seem to master the correct expression that evaluates to "True"

Any help in this matter would be appreciated.



------------------------------
Thank you,
Chuck
------------------------------
  • Is your duration set to always be in days? If so, I would create a new formula numeric field: [Duration as Number].

    Though it might seem like ToNumber([Case Age]) should work, I believe that will give you an error. I believe you need to use: ToDays([Case Age]). Then use that new formula numeric field in your query.

    I am sure there is a also a fancy way to do it in Pipelines with an Advanced Query written in Jinja, but that is over my head!



    ------------------------------
    Mike Tamoush
    ------------------------------
  • Chuck,

    Duration fields are natively in milliseconds.   Try using a value of 

    144000000

     



    ------------------------------
    Don Larson
    ------------------------------
    • CharlesDulaney's avatar
      CharlesDulaney
      Qrew Trainee

      Don,

      You-da-man~!

      I did not realize the case age output in pipelines was in milliseconds, everything is resolving correctly now.



      ------------------------------
      Charles Dulaney
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Elite

        You are welcome. 

        I had a similar problem a few months back and it took quite some time figure this our.



        ------------------------------
        Don Larson
        ------------------------------