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