Separating JSON Result into Repeating Group Rows

Hi all,

My API is working properly, however I’m currently receiving all results as comma-separated values in a single variable instance. What I want however, is for each row in a repeating group to represent its own value.

The list appears sort-able, when I select things like
item#: Current Cell's Index
or
:first item

The image below shows a repeating group where only the first row is being represented.

1 Like

Try expanding the RG data source to include what you have in the text, i.e. body option chain result’s strikes: first item.

So yes I’m able to do that, but I only get the first comma-separated value. The others don’t repeat throughout the other repeating group’s rows…

What does the “raw data” look like in the API Connector? And how does it map to the “body option … etc” labels?

So from what I can tell it’s a JSON being properly parsed but being viewed as a block of comma-separated values. What’s the best way for me to share this?

The raw API link is (no auth):
https://query1.finance.yahoo.com/v7/finance/options/amd

Under “raw data” on API Connector I’m seeing this as a snippet.

"contractSymbol": "NVDA181019C00230000",
                                "strike": 230,
                                "currency": "USD",
                                "lastPrice": 16.3,
                                "change": 0,
                                "percentChange": 0,
                                "volume": 305,
                                "openInterest": 436,
                                "bid": 0,
                                "ask": 0,
                                "contractSize": "REGULAR",
                                "expiration": 1539907200,
                                "lastTradeDate": 1539719298,
                                "impliedVolatility": 0.000010000000000000003,
                                "inTheMoney": true

Right now, each of these categories is being put into a single csv group. For example:

“strike” would bring back every strike less than and greater than 230… “210,215,220,225,230,235,240…”

So then what Bubble calls body optionChain result’s strikes would be a list of numbers, can you use that as the repeating group data source?

The “contractSymbol” snippet above is a different part, Bubble might make it available in body optionChain result’s options’s calls as a list of objects, can you make that as a RG data source too, then each cell can get contractSymbol, strike, currency, etc.

Can you show the part of the API connector which converts the data into a list and names it?

The column on the right shows where there is another subsection according to Bubble …



You should be able to address each subsection separately … mine looks like:
image
and
image

Picking the last example, I put a text element in the cell:
image

And it looks like:
image

3 Likes

Wow fantastic, thank you Mishav!!!

I now am working through a slightly different problem:
Trying to identify the index (item #) in the repeating group where a certain condition is true.

Example:
I’m able to detect if a certain number (in the input field) is in the “strike list” on the repeating group (photo 2) but I can’t reference the item # and therefore refer to the other properties in that item.

Good that you got further, @Cedric

Yes, Bubble does lack a function to find the position of an item in a list.

There are three other things you can do …

  1. Create a group with source to filter the results to match the input. Elements in the group have access to the other fields on the matching item.

  1. An element in the repeating group cell can do the comparison, to know that it is the matching cell.

  2. You could send the list of strike numbers to javascript, and return the position to Bubble.

2 Likes

Fantastic, thank you Mishav… I successfully implemented the filter-based approach though it feels like a workaround… Will definitely be exploring a path forward with Javascript.

You’re a true expert on this stuff

1 Like