Search code examples
expressionazure-data-factoryhour

Azure Data Factory - If Condition only run on specific hours


I'm trying to build a control flow in ADF pipeline where an If Condition should only run on specific hours of the day. The pipeline has a trigger that runs every hour, but because of run limitations in the external system, this system should only be called at 6, 8, 10, 12 and so on during the day.

In SQL I would do something like CASE WHEN DATEPART(HOUR, GETDATE()) IN (6,8,10,12) THEN 1 ELSE 0

I fully believe there is a way to construct such an expression in "dynamic content", but I really don't know where to being. Should the hours be there written in an variable array or directly in the expression?

Thanks in advance!


Solution

  • I think your requirement could be implemented with built-in expression supported by ADF.

    Please try configure Dynamic content in the If-condition Activity as below:

    @contains('06081012',substring(formatDateTime(utcnow()),11,2))
    

    enter image description here