Reputation: 27
In my Synapse pipeline, I am looping through a set of filenames. Inside the loop, I use a "Get Metadata" activity to retrieve the last modified date of each file and append these dates to an array variable using the "Append Variable" activity. After the loop completes, I want to extract the maximum date value from the appended array and store it in a separate variable outside the loop.
outside the loop I have a set variable
Able to retrive the first value using the expression in set variable value as @variables('GetLatestFile')[1]
But not sure about how to get the max value from the values in array. For set variable activity I have the variable type as string.
Upvotes: 0
Views: 71
Reputation: 8402
To compare Last modified dates and get max date from it you need to use the if activity as below:
RefDateTime
variable in pipeline with ample value as 1900-01-01 00:00:00@greaterOrEquals(ticks(activity('Get Metadata2').output.lastModified), ticks(variables('RefDateTime')))
it will check the incoming date for the file is greater than our reference date or not.
RefDateTime
variable.Now you can take set variable activity outside forech activity and fetch the value of RefDateTime
in it will return you max value from all the last modified dates.
Upvotes: 0