Wrong expression in flow repeat

Hi everyone,

I had a lot of good and bad surprises using Wappler. Some complex work made easy and simple things not working for weeks. ChatGPT helped me with a lot of things, except this one:

I have a page flow in auto run. I need to connect to a database to populate a data store if the data store is empty:

<script is="dmx-flow" id="default_selected_stats" type="text/dmx-flow" autorun="true">{
  condition: {
    if: "{{!user_selected_stats.data.hasItems()}}",
    then: {
      steps: [
        {
          serverConnect: {
            url: "/api/account/query_stats_list",
            site: "domainbear",
            name: "query_stats",
            outputType: "object"
          }
        },
        {
          repeat: {
            repeat: "{{query_stats.data.query_stats_list}}",
            outputFields: ["id", "stat_code", "stat"],
            exec: {
              steps: {
                run: {
                  action: "{{user_selected_stats.insert({stat_code: repeat_stats[0].stat_code, stat: repeat_stats[0].stat})}}",
                  name: "insert_stats",
                  outputType: "text"
                }
              }
            },
            name: "repeat_stats",
            outputType: "array"
          }
        }
      ]
    },
    outputType: "boolean"
  }
}</script>

The problem is that it does get 13 records, but empty…

Here is also a visual preview of the flow editor:

Thanks a lot!
Edouard

Everything looks correct, except this:

This looks wrong, the values should be just stat_code instead of repeat_stats[0].stat_code and stat instead of repeat_stats[0].stat.
Did the data picker generate these wrongly?

Hi @Teodor :slight_smile:

Yes it seems to pick the wrong value in the repeat.

Now that i tried to manually set “stat” and “stat_code” instead of the values beginning with repeat_stats[0], it works well! :slight_smile:

Thanks a lot @Teodor :muscle: