Dynamically Create List of Times

DC-q489h2 126 Reputation points
2021-05-26T21:01:02.357+00:00

I would like to dynamically create a list of times between a start and end time parameter. I will then use this list of times to pass into a for each activity in my pipeline and make iterative calls to an API. From my research I have not found any suggestions on how to go about this yet, any suggestions would be welcome.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,696 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,197 questions
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,386 Reputation points Microsoft Employee
    2021-05-28T01:02:00.79+00:00

    Hello @DC-q489h2 ,
    Thanks for the ask and using the Microsoft Q&A platform .

    Let me underatand the ask , I think you have a startdatetime and you want to have all the time at regular intervals which is less then some enddatime . You want this to be in array , which you can pass to an foreach ( FE ) loop .

    If my understanding is correct , you can acheive this by using a pipeline with Start and enddate parameters , create a variable of type array ( this will have all the time entries ) . One FE loop , which will iterate for N time and I am using the range function . I am using
    addhours function . The logic is very simple , the below animation should help .
    I am sharing the key dynamic exprtession which should help .

    @range(1,10)      
    @bool(less(pipeline().parameters.starttime,pipeline().parameters.Endtime))      
    @addhours(pipeline().parameters.starttime,item())  
    

    Please do let me know how it goes .
    Thanks
    Himanshu
    Please do consider clicking on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    100412-array.gif