I have a flow that calls a browser mod popup and populates the content of the popup using the data field. Currently, this is what I have in the data field:
{
"title": "{{payload.0}}",
"content": "<h3>{{topic.1}}</h3></p>{{payload.1}}</p><h3>{{topic.2}}</h3></p>{{payload.2}}</p><h3>{{topic.3}}</h3></p>{{payload.3}}</p><h3>{{topic.4}}</h3></p>{{payload.4}}"
}
The resulting data is pulled from a Global variable in NodeRED which happens to be an array that’s populated with data from a Google sheet.
In the above example, the “Title” field is the first column of the spreadsheet, or the first item in the array. The “content” renders as HTML in the popup. What I’m looking to do is display an image in the popup based upon the value (i.e. category) of one of the columns in the spreadsheet. To do this, I would either need to simply create the URL in the spreadsheet, or…
…can I add conditional logic inside of the “content” on this JSON example? If {{payload.1}} = “A” then “<img source="this.jpg">
” else something here?