Can a key in a datamap have multiple values?

Hello,

You could nest the color like so.

<<set $paintingSelection to {
	"Blackbyrd":  {
		id: 1,
		color: {
               prominent: "red",
               primary: "grayscale"
               },
		subject: "animal",
		mood: "melancholia/depression",
        style: "illustration/sketch"
	}
}>>

Or what Aster suggests. :slight_smile:
Also, Change this object to an array of Objects. Then you can randomly select one and access the values with dot notation.

<<set $paintingSelection to [
	{
		id: 1,
        name: "Blackbyrd",
		color: {
               prominent: "red",
               primary: "grayscale"
               },
		subject: "animal",
		mood: "melancholia/depression",
        style: "illustration/sketch"
	},
	{
		id: 2,
        name: "Voice of Perseverance",
		color: {
               prominent: "black",
               primary: "yellow"
               },
		subject: "human",
		mood: "joy/happiness",
        style: "photorealism"
	}
]>>
<<set _temp to either($paintingSelection)>>
<<= _temp.name >>
//color
<<= _temp.color.primary >>

The output would then be the randomly selected object values.

3 Likes