dynamic source dataset expression

arkiboys 9,706 Reputation points
2024-02-22T10:29:32.7433333+00:00

Hello, In ADF copy activity source I have created a dataset to look at .csv file at source.
The format of the source file names are for example:
abc-15 february 2024
abc-14 jan 2024
... notice the date month can be either long or short.
How can I cater for this month change format in the expression?
At present my expression is like this:

@concat('abc-',formatDateTime(dataset().p_CurrentDate,'dd'), '-',formatDateTime(dataset().p_CurrentDate,'MMM'),'-',formatDateTime(dataset().p_CurrentDate,'yyyy'),'.csv')
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

Answer accepted by question author
  1. QuantumCache 20,676 Reputation points Moderator
    2024-02-28T21:43:16.4366667+00:00

    arkiboys Did you consider using any if condition checking length of p_CurrentDate? something like the below sample expression/ Note: Capture the Lengths of dataset().p_CurrentDate into a Variable first. Below expression is just an idea to take decision on the length basis... Please try and do let us know... User's image

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.