Accessing a global variable in dictionary in Application Designer

jjc_al
jjc_al Registered Posts: 5 ✭✭✭

Hi,

In my DSS application, I want to display a global variable that is inside a dictionary in my project variables using the "Variable Display" tile.

Global variables for my project look like this:

{

"editable_by_user": {
"data_start_date": "2022-09-01"

}

}

I can access the "editable_by_user" dictionary with ${editable_by_user}, however, how do I access editable_by_user["data_start_date"] in the Variable Display tile?

Thanks in advance!


Operating system used: Linux

Best Answer

  • Sarina
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
    Answer ✓

    Hi @jjc_al
    ,

    Indeed, you are correct that there isn't a way to access a nested variable value within DSS where the ${variable} syntax is required. I suggest posting this on the Product Ideas board. For now, the only option would be to create an unnested variable.

    Thanks,
    Sarina

Answers

  • jjc_al
    jjc_al Registered Posts: 5 ✭✭✭

    Hi SarinaS,

    Thank you for your answer. Using unnested variables is indeed the solution I have found for now.

    Best,

    JJC

  • timchen
    timchen Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer Posts: 7 ✭✭✭

    Hello,

    It's been two years since this questions got answered. Is there a way to get the nested variables in the sql now?

  • Sarina
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker

    Hi @timchen
    ,

    Indeed, nested variables can be retrieved through the parseJSON function:

    Screenshot 2024-04-24 at 5.18.41 PM.png

    Screenshot 2024-04-24 at 5.18.25 PM.png

    Thanks,
    Sarina

  • timchen
    timchen Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer Posts: 7 ✭✭✭

    Is it possible to do the same in the SQL recipe?

  • Sarina
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker

    Hi @timchen
    ,

    Indeed it's not possible to use nested variables in a SQL Recipe. You would either need to use a Python recipe or a Visual recipe if you wish to use nested variables.

    Thanks,
    Sarina

Setup Info
    Tags
      Help me…