I have an interator loop that is cycling through some data. I want to put a test in that loop, exectute some additional logic in some cases then return to the flow. I cannot for the life of me figure out how to do this basic thing in make.
A simplified example of what I am doing is bucketing data. Imagine some json data for a script that looks like this:
"dialogue": [
{ "speaker": "A", "line": "Hi. Nice to meet you. " },
{ "speaker": "A", "line": "My name is person A" },
{ "speaker": "B", "line": "Hi A, I'm B" },
{ "speaker": "A", "line": "Cool - we should hang" },
]
The end result I am trying to get to here is:
SPEAKER A
Hi. Nice to meet you. My name is person A
SPEAKER B
Hi A, I’m B
SPEAKER A
Cool - we should hang
The approach I was trying to do was:
Loop through line by line {
Set a variable for the speaker
Test vs LastSpeaker. if speaker has changed {
Add speaker label to the aggregate text
Increment count of speakers
Update LastSpeaker
}
Add text to aggregate text
}
Do some stuff with the result
I think I am not “thinking in make.com” yet. How would you do this?