'Having issues extracting year and month via array in Azure Data Factory
The purpose of this flow is for the user to enter a date (ex: 12/1/2021) as well as number of months to loop back. The first pipeline, "Date" accepts these parameters then is supposed to extract the month and year from these dates as it loops back. It should pass this to the "Master" pipeline which should pass the month and year as separate values to the sql scripts I am running. For testing purposes, I am entering 12/01/2021 as the start_date parameter and 12 as the months_count parameter.
I am using the following dynamic content for append variable:
@subtractFromTime(
pipeline().parameters.start_date,
item(),
'Month'
)
In the execute pipeline, I am using the following to extract the year and month:
RUN_YEAR: @variables('DateRange')[substring(item(),1,4)]
RUN_MONTH: @variables('DateRange')[substring(item(),6,2)]
However, I am getting an error:
'The template language function 'substring' expects its first parameter 'string' to be a string. The provided value is of type 'Integer'.
I tried casting the data types but I do not know the proper syntax for this. Is there a way to cast the contents of an array so I can properly extract the month and year then pass them as variables to the next pipeline?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|