Using a variable or not depending on the scenario

Saigo_Takamori
Saigo_Takamori Registered Posts: 1

Hi guys, I have a flow with 2 different scenarios. I have one variable v_idproduct used in a post filter join recipe in a sql code (id_product IN v_id_product). In each scenario I have a different list of id products.

I want to modify one of the scenarios so that this filter is no longer applied, allowing all product IDs to be selected. However, I'm not sure how to achieve this, as I assume I still need to define the variable list in my scenario.

Thank you !

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,321 Neuron

    It depends on how you want to handle variables. Personally I prefer to define at scenario level with a Define variables scenario step and then use in the SQL expression in recipes. However you do get an error as the recipe doesn't see the variable until it runs under the scenario so I also define them with dummy values as project variables. You could use a set project variable scenario set but that's dangerous as two different scenarios could change the same variable and also the vsriable value is left in the project. That's why scenario variables are better as they are only available for that scenario only.

Setup Info
    Tags
      Help me…