Using JSON to travers a list of values in a Message Card in an MS Teams Reporter of a Scenario

Marty
Marty Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 9 Partner
edited July 16 in Using Dataiku

I have a list of values that I created in a Python, called "breach_list". It contains anywhere from 1 to 24 strings representing variables that have breached a threshold. I've set up some steps in a Scenario, the final one being a "send message" step. That step sends a message to an MS Teams page if a breach occurs (determined by if a check on the data fails). I want to be able to display the elements of that breach list, but right now all I can do is display the entire list. Here is what it looks like right now:

Dataiku Image.png

The JSON code in the MS Teams message is as follows:

@{
    "@type": "MessageCard",
    "@context": "https://schema.org/extensions",
    "themeColor": "${if(outcome == 'SUCCESS', '29AF5D', '')}${if(outcome == 'FAILED', 'F44336', '')}${if(outcome == '', '28A9DD', '')}",
    "summary": "${scenarioName} run report",
    "sections": [
        {
            "text": "${if(outcome == 'SUCCESS', '✅', '')}${if(outcome == 'FAILED', '🔴', '')}${if(outcome == '', '🔔', '')} ${scenarioName}: **${outcome}**",
            "facts": [
                { "name": "Project", "value": "${scenarioProjectKey}" },
                { "name": "Triggered by", "value": "${triggerName}" },
                { "name": "Thresholds breached", "value": "${breach_list}"}
            ]
        }
    ],
    "potentialAction": [
        {
            "@type": "OpenUri",
            "name": "View Report",
            "targets": [
                { "os": "default", "uri": "INSERT URL HERE" }
            ]
        }
    ]
}

In the above code block, all I do is sent it ${breach_list}, but I'd really like to iterate through the elements of that list and print them each out on a separate line. Something like this:

Thresholds breached

Increase in Scorability Mismatch
EXP Percent Problem Cases 7 Days or Less
EXP Percent Problem Cases 20 to 40 Days

How do I do this in JSON and in the messages card?

Thanks!


Operating system used: Windows


Operating system used: Windows


Operating system used: Windows


Operating system used: Windows


Operating system used: Windows

Answers

Setup Info
    Tags
      Help me…