Custom scenario on variable change

Solved!
lau_sch
Level 2
Custom scenario on variable change

Hello,

my trigger does not launch with this trigger even though variables VAR_A and VAR_B are set to 1 : 

from dataiku.scenario import Trigger
import dataiku

PROJECT_ID = "RCU_V2"
client = dataiku.api_client()
project_handle = client.get_project(PROJECT_ID)
variables = project_handle.get_variables()
print(variables)

t = Trigger()

if variables['standard']['VAR_A'] == 1 & variables['standard']['VAR_B'] == 1:
      t.fire()

 

0 Kudos
1 Solution
Turribeach

Please use code blocks (</> icon) when you post Python code as otherwise we can't easily copy/paste your code to test (as Python requires strict identation). You should replace your & by and:

if variables['standard']['VAR_A'] == 1 and variables['standard']['VAR_B'] == 1:
    t.fire()

 

https://www.geeksforgeeks.org/difference-between-and-and-in-python/

 

View solution in original post

0 Kudos
2 Replies
Turribeach

Please use code blocks (</> icon) when you post Python code as otherwise we can't easily copy/paste your code to test (as Python requires strict identation). You should replace your & by and:

if variables['standard']['VAR_A'] == 1 and variables['standard']['VAR_B'] == 1:
    t.fire()

 

https://www.geeksforgeeks.org/difference-between-and-and-in-python/

 

0 Kudos
lau_sch
Level 2
Author

Thank you for your reply ! 

0 Kudos