Bubble data as an object

Hey all, I’ve been struggling with this for a few hours now. I have no idea how to use an entry from my database as an object in my code. I have javascript code running in an html element and i want to pass a list of objects from my databse do it. However, if i try to do it as dynamic data by doing a search for, i can only pass one field from my database as a list, rather than every entry as an object.

This is the code i want to use it with:

    let gData = []; // Initialize an empty array

    // Retrieve data from Bubble database
    const bubbleData = []; // ***This is where i want to get all the entries from my database which have fields for "name" ,  "location" etc.***

    // Loop through the Bubble data and format it for visualization
    bubbleData.forEach(item => {
        const dataItem = {
            name: item.name,
            markerID: item.markerID,
            lat: item.latitude,
            lng: item.longitude,
            size: 20,
            color: "beige",
        };

Would appreciate any help :sweat_smile:

I’m not a coder so I can’t tell for sure if the issue is with the code itself or with the ability to pass a list of things…from the description it sounds like it is the code.

Are you asking for help with constructing your custom code?

looks like the code is requesting an array…which would mean you need to pass it as an array, which is JSON, which Bubble gives a format text operator in dynamic expressions which allow you to format Bubble lists as an array

1 Like

Oh yeah. Never thought i could use format as text this way :sweat_smile: :sweat_smile:
Thank you

1 Like