List in project variables

Alexandre78
Level 1
List in project variables

Hello,

I would like to know if it is possible to create a list as a Project variable and to use the different items of this list later in a recipe. For example, if we want to filter a dataset and keep only the ID which are in the list we defined in the Project variables section.

 

 

 

0 Kudos
1 Reply
SarinaS
Dataiker

Hi @Alexandre78,

You can indeed create JSON objects in project variables, including arrays. In order to interpret the variable as a list, you do need to either use the formula language or Python in order to interpret it as a list and not a string. 

Here's an example using the formula language to filter a column based on a list of values. Similar logic can be applied anywhere you can apply the formula language or in a Python recipe. Here's a list of order ids defined in project variables:

projectvariables.png

And how to use the array functions from the formula language to apply to the variable: 

LplRKEpiScfJa2ameVUWY1PvwvWRsmkDuA (1).png

I hope that information is helpful. If you have any questions, feel free to attach some screenshots of your specific use case so that we can provide more specific context. 

Thanks,
Sarina 

 

0 Kudos

Labels

?
Labels (1)
A banner prompting to get Dataiku