Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: rpigneriDear Mike,
Your original solution required a trick called "do output" allows you to output the more than a single output row for a given input row or rows. This form of output is a special case for many nodes so you have to provide some additional information than in a normal output situation.
In order to signal to the node that you want to output multiple rows, you need to wrap the emit statement in question in a "do output" block. However, before you can output any data, you also need to set the output metadata for the pin that will be used in the do output block. This metadata setup allows you easily to output the input record and then augment that record with some specific data that comes from the while loop. You can see this feature demonstrated in the attached graph in the node entitled "Do Output Example".
To show this "do output" feature in action, I replaced the code in your Agg with the following:
if firstInGroup then {
ValueList = list()
}
# Set up the metadata so the node is ready for the extra output rows.
output 1
{
emit "" as "Val1", "" as "Val2" where false
}
ValueList = ValueList.append(value)
if lastInGroup then {
counterA = 0
while counterA < len(ValueList) {
counterB = counterA + 1
while counterB < len(ValueList){
Val1 = str(getItem(ValueList, counterA))
Val2 = str(getItem(ValueList, counterB))
do output 1 {
emit Val1, Val2 # You no longer get an error
# since this statement is in
# a do output block!
}
counterB = counterB + 1
}
counterA = counterA + 1}
}
In magenta--you can see that my skills do not extend to visual art --I have added two blocks of code to address the output issue. The first block sets up the metadata of the output pin for use in the second block. The second block then outputs the data. The green block was added to avoid duplicate output records that were output before all the elements in the list were added.
I have attached an updated version of the original graph with the changes explained above for your reference.
Hope that helps,
Rocco
Attachments:
BreakData.brg