Azure "If condition" Expression

Kerri Otis 21 Reputation points
2022-03-31T15:20:36.897+00:00

I have a pipeline that fails after the server is paused and on the weekends when the server is not up and running. I would like to eliminate these failed pipelines, but fixing the "if condition expression", to add Mon- Friday run between 7-3pm only.

I am new at this so here is the "if condition".

"Expression"
@ANDO (GreaterOrEquals(utcnow(),convertTimeZone('07:00:00','Eastern Standard Time','UTC')),LessOrEquals(utcnow(),convertTimeZone('15:00:00','Eastern Standard Time','UTC')))

This is on the Event Storage Trigger or I would have created the trigger to only run these certain days.

Does anyone know how to put that together so I can eliminate the errors, after hours within my pipeline?

Thanks,

Kerri

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
8,519 questions
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 35,796 Reputation points Microsoft Employee
    2022-04-04T09:26:24.863+00:00

    Hi @Kerri Otis ,

    Thank you for posting query in Microsoft Q&A Platform.

    As per my understanding you want to validate is it weekday and between 7 to 3PM of EST in pipeline and if it matches then only process activities execution inside IF activity. Please correct me if I am wrong.

    The expression you shared will do its part perfectly validating time is between 7 to 3PM EST or not. But its missing logic of validating its weekday(MON to FRI) or not. You should consider weekday validation also in to your expression logic.

    dayOfWeek function helps to get weekday number in ADF expressions. The day of the week from the specified timestamp where Sunday is 0, Monday is 1, and so on.
    Below expression will do weekday validation as well along with time validation of between 7 to 3PM EST. Kindly use the same in to your IF activity.

    @and(  
     contains('12345',string(dayOfWeek(utcnow()))),  
     and(  
     greaterOrEquals(utcnow(),convertTimeZone('07:00:00','Eastern Standard Time','UTC')),  
     lessOrEquals(utcnow(),convertTimeZone('15:00:00','Eastern Standard Time','UTC'))  
     )  
     )  
    

    You can also consider running your pipeline only on weekdays using schedule trigger. Click here to know more.
    189701-image.png

    Hope this helps. Please let us know if any further queries. Thank you.

    --------------

    Please consider hitting Accept Answer button. Accepted answers helps community as well.


0 additional answers

Sort by: Most helpful