Need some help with using serversided datamanagement and arrays

I use an API to get data, the API request works fine. Then I follow up with a repeat so I can put part of the data in a List, as explained in Wappler Documentation - Working with Server Connect Array Lists.

When I run the action, it gives the expected values in the 'repeat' section, when output is on. So in this case it gives a value for the datafield 'close' which is correct. I then try to store the data in the list I created, wherein is a single variable called 'close' as Text. When I now try to add in the value 'close' in the created list, it doesn't add the value. It gives me 100 empty results.

So, to recapitulate, I created a list with a text value, run the repeat on the amount of data from the API-request, 100 returns, the repeat shows the datafield 'close' and gives the right number for each of the 100 fields. I try to store this same number from the repeat in the field, and the list is filled with 100 empty records.

If I check with 'Size' how big the List is, then I get 100 values in return: so that's good. If I check with 'isempty' I get false as a return, so: also good. But when I ask for the stored values, the same as the output of the repeatfunction gives with no errors at all, then I get 100 empty records.

repeat: [

  • {

      1. close: "232.1000"},
  • {

      1. close: "219.8000"},
  • {

      1. close: "220.2500"},
  • {

      1. close: "215.9900"},
  • {

      1. close: "246.3800"},
  • {

      1. close: "251.5100"},
  • {

      1. close: "239.2000"},
  • {

      1. close: "249.2300"
        ........
  • isempty: false,

  • values:[

    • { },

    • { },

    • { },

    • { },

    • { },

    • { },

    • { },

    • { },

    • { },

    • { },

.........

What am I missing here?

Thanks in advance for your time and effort!

Can you please post a screenshot from the dev tools > network > xhr where we can see the actual output of the api or the repeat?

Do you mean this?

api: {

......

You can create code blocks like this:
```
// Code goes here
```

Becomes:

// Code goes here
1 Like



What is this API you are using? Its response is not a valid JSON, the property names it is returning are like this:

4. close: "123.456"

which is wrong.
This should be something like:
"close": "123.456"

So what is the API you're using? Is it under your control?

No, sadly not. It's the AlphaVantage API for stockmarket data. But yes, they give all this data in a weird way. I just don't understand though how the repeat gives the data (the value of 4. close:) and then I can't store this data in the list. The same number I mean as given by the output of the repeat.

It's of course just the number I'm after :slight_smile: :slight_smile:

And by the way, the return is indeed JSON. You can also get the data in .csv. But the standard response is JSON. Although it looks to be nested and with weird values for the fieldnames.

But when looking at their examples here:

https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&outputsize=full&apikey=demo

The JSON is properly formatted and property names are wrapped in double quotes so the JSON is valid:

Aha! Okay.... I think that's the way my browser parses the JSON. When I click on the https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo link, I get the following:

It's a browser extension that does the parsing.

Ok the i see.
In Wappler you need to get the proper schema, but that's also an issue because of the spaces used in keys/property names.

Please open your alphavantage api directly in the browser and copy the response from there, after that open the API step and paste it in the Schema source window, then click the get button:

this will make the schema available and all the weird formatting in the key names properly escaped for the next steps. So you will be able to pick all the values for the repeat and the steps inside it.

Just for good measures and completeness I'll send this as well:

Oh very nice! I am going to try this! Thanks a lot...! I'll keep you posted.

Again, thanks for all the time and effort!

I see you already have the correct schema, but the property names with spaces and dots are just messing the things.
You will need to manually adjust the value in the Add In Array step to this:

it should be _['4. close'] in the code view of the data picker dialog in order for it to work properly.