treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.3k stars 221 forks source link

How to add two conditions in the if statement in digdag? #1794

Closed chaitu4110 closed 1 year ago

chaitu4110 commented 1 year ago

I have tried like below. Please ignore the indentation. Appreciate your help.

+range:
  for_range>:    
    from: 0    
    to: 5    
    step: 1  
  _do:

    +if_to:      
      if>: '${range.to == "5"}' and '${var_true == "true"}'      
      _do:        
        fail>: reached max loop limit
**OR**
+range:
  for_range>:    
    from: 0    
    to: 5    
    step: 1  
  _do:
    +if_to:      
       if>: '${range.to == "5" and var_true == "true"}'      
      _do:        
        fail>: reached max loop limit
sakama commented 1 year ago

Hi @chaitu4110

Could you try && instead of and ?

AND

if>: ${var1 == 'abc' && var1 == 'def'}
_do:
  echo>: condition is true
_else_do:
  echo>: condition is false

OR

if>: ${var1 == 'abc' || var1 == 'def' || var1 == 'hij' }
_do:
  echo>: condition is true
_else_do:
  echo>: condition is false
chaitu4110 commented 1 year ago

Thank you @sakama