Legacy Dev Forum Posts

 View Only

Sign Up

I am trying to set an interval to date today everyday

  • 1.  I am trying to set an interval to date today everyday

    Posted 06-05-2025 18:43

    Chris_Carr | 2021-11-10 21:23:29 UTC | #1

    Hi,

    I am creating a data action that uses query "/api/v2/analytics/conversations/details/query" and I am trying to input an interval which is todays date automatically for example "2021-11-10T00:00:00.000Z/2021-11-11T00:00:00.000Z"

    How do I create or which function do I use to set the interval to today, please?

    Here is my JSON request

    { "interval": "${input.interval}", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": 25, "pageNumber": 1 }, "segmentFilters": [ { "type": "or", "clauses": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "ani", "operator": "matches", "value": "${input.ani}" } ] }, { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "callback" }, { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "bf44e441-5566-48c6-99b5-4e00b1c60ce9" } ] } ] } ], "conversationFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "conversationEnd", "operator": "notExists" } ] } ] }

    Thank you.

    Kind Regards, Chris


    Chris_Carr | 2021-11-10 21:27:19 UTC | #2

    Would this work?


    Jason_Mathison | 2021-11-15 14:43:46 UTC | #3

    Are you attempting to do this in an Architect Flow, Script, other?


    Chris_Carr | 2021-11-22 14:07:02 UTC | #4

    Hi Jason,

    Thank you for reaching out.

    I am using an in-queue call flow that uses a data action that contains the following body. I am trying to get set the interval to today dynamically everyday. Currently I am using a manual interval.

    { "interval": "2021-11-10T00:00:00.000Z/2021-12-10T23:00:00.000Z", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": 25, "pageNumber": 1 }, "segmentFilters": [ { "type": "or", "clauses": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "ani", "operator": "matches", "value": "${input.ani}" } ] }, { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "callback" }, { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "6a949fa5-b24d-44a3-b1ff-de4f9153aee2" } ] } ] } ], "conversationFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "conversationEnd", "operator": "notExists" } ] } ] }

    Thank you

    Chris


    Jason_Mathison | 2021-11-22 14:58:46 UTC | #5

    I don't think that the architect tool you showed above would help you, it's purpose appears to be to figure out if you are currently in a certain time range. So you might use it for questions like is this after hours or something.

    If you are ok with today's date in UTC then I think you could make a couple of variables like BeginningDate = MakeDateTime(Year(GetCurrentDateTimeUtc()), Month(GetCurrentDateTimeUtc()), Day(GetCurrentDateTimeUtc()))

    EndTime = AddDays(BeginningDate, 1)

    If you need to account for timezone you can use the addHours method.

    Hopefully from there you can use the ToString(variable) to get the time into a format appropriate for the data action. If you have any problems I recommend posting your question to the Architect room to get the right people looking at it.

    --Jason


    Chris_Carr | 2021-11-24 13:44:12 UTC | #6

    Thanks Jason, will give this a go.


    system | 2021-12-25 13:44:34 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 12612