0

For one of the flows, I am using below condition to trigger the flow and it works completely fine: @greaterOrEquals(items('Apply_to_each')?['Date'], utcNow('MM-dd-yyyy'))

Basically I am checking if one of the date fields value is greater or equal to today, if yes then do something.

The challenge I am facing is how would I add another and condition to the above as: Status does not equal to "Used". I am not sure how do I append this as an AND condition to the above formula.In theory it should check two things, date value is greater or equal to today and status is not equal to "Used". Currently its only checking for date part.

This could be really simple but i am new to flow so any help would be greatly appreciated, thanks in advance.

  • 1
    Did you try @AND(<expression1>, <expression2>) ? – Prasanna Sep 7 '18 at 20:35
  • I am not good at flow so which is exactly why I am looking for a solution to my issue. I am not sure how not equals can be configured, it would be better if you give an example, would be very helpful. – mdevm Sep 7 '18 at 20:42
  • Ex: @AND(greaterOrEquals(items('Apply_to_each')?['Date'], utcNow('MM-dd-yyyy')), not(equals(items('Status')?['Value'], 'Used'))) – Prasanna Sep 7 '18 at 20:44
1
@and(condition1,condition2)

so:

@and(equals(items('Apply_to_each')?['direction']?['Value'], 'north'),not(equals(items('Apply_to_each')?['Status']?['Value'], 'Active')))

As an aside, the documentation leaves a bit to be desired, but the official "Functions reference for Workflow Definition Language" for these functions are here.

  • Thanks Mike, I got the condition 1 but for condition 2, I need to check for notequals rather than equals. – mdevm Sep 7 '18 at 20:44
  • I edited my answer. Prasanna also has it: put the equals in a not(). – Mike2500 Sep 7 '18 at 20:54
  • Hi, I edited the condition as: @AND(greaterOrEquals(items('Apply_to_each')?['Date'], utcNow('MM-dd-yyyy')),not(equals(items('Apply_to_each')?['Status'], 'Used'))). Still the condition 2 is not being considered by flow. Is there a syntax probelm? – mdevm Sep 7 '18 at 20:58
  • I don't know the data types you're using, are you perhaps missing the ?['Value']. That would cause the behavior you're seeing. The cheap trick to get the correct syntax is to copy the whole thing to notepad, and then set up a single condition using the graphical editor, and then switch back to advanced. – Mike2500 Sep 7 '18 at 21:19
  • Yes I was missing the value attribute updated the condition as : @AND(greaterOrEquals(items('Apply_to_each')?['Date'], utcNow('MM-dd-yyyy')),not(equals(items('Apply_to_each')?['Status']?['Value'], 'Used'))) and it works fine now. I tried the basic mode to generate the query for one segment, copied it to notepad and then put both segments together. I am learning, thanks again for the inputs guys, much appreciated. – mdevm Sep 8 '18 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.