Legacy Loops in Workflows

I've followed the discourse in the thread here on workflows;

This has provided a few solutions. However, I have two blocks that return similar looking data. The first from stripe;

{
  "data": [
    {
      "id": "plink_1QGc3XXX4XXXnePDN7EYhV3oyc",
      "url": "https://buy.xxxxxxxx.com/b/cN2dRb1Maderfauihnl"
    }
  ]
}

The second from tinyurl;

{
  "data": [
    {
      "data": {
        "domain": "tinyurl.com",
        "tiny_url": "https://tinyurl.com/xxxxxx"
      },
      "code": 0,
      "errors": []
    }
  ]
}

When I try to work the second result into an object in legacy loops I get an empty array. Can anybody see why?
Secondly, does anybody know how to retain the keys in new loops as you can in legacy by editing the loop code;

const results = ;
for (const [index, value] of query37.data.entries()) {
const result = await query38_lambda.trigger();
results.push({
loop_result: result,
email:value.email,
invoice_id:value.invoice_id
})
}
return await Promise.all(results)

Hi John Hughes,

On the first line you have const results = ;
And then on line 4 you have results.push...
Results is not an array so you cannot push into it. So you should start with `const results =

It's possible you have other problems, but that is one of them. I would think you should have gotten an error in the debug console or somewhere.

Sorry Julius, it does actually start like that, it just didn't copy over like this. Posted a picture for clarity;

image

John,

I guess you deleted that previous post? It might be helpful to post some more screenshots to give us some more context.

  1. When you say "work second result into an object", what does that mean?
  2. Not sure about second part at all. You're looping over tracking numbers, checking some status and kicking off some apis. But what keys do you want to retain?

Have you considered exporting your workflow so we could see more details? There's a button in the top right corner.

Hi @John_Hughes! I'm still a little unsure about what you're trying to accomplish here, so it might be helpful to see a JSON export of your workflow in its current form.

Looking at what you have shared, the first thing I notice is that it doesn't make much sense to store anything under a key of info inside the results array. It's likely not related to the behavior that you're seeing, but I thought I'd point it out.

If the results array is ending up empty, I'd first look at query35.data and verify that the value associated with entries is actually an invokable function.