Search code examples
javascriptfilemaker

Add the content of a variable whose name contains ::


I am building a site using javascript. My data comes from a FileMaker API.

My goal is to fill an array with the data retrieved from the FileMaker API.

Except that this data comes from a linked table in FileMaker, which appends :: to the name of the variable.

Here is the code I'm trying to do, but with :: it doesn't work. How can I go about including ::?

for(var i=0;i<allFEC.length;i++)
{
    programmesMovies.push({
        "isOnline_b":1,
        "_idWeb_c": allFEC[i].pro_FIP::_id_FEC
    });
}

enter image description here


Solution

  • Anything that has spaces or any such weird syntax you can access it using square brackets

    for(var i=0;i<allFEC.length;i++)
    {
        programmesMovies.push({
            "isOnline_b":1,
            "_idWeb_c": allFEC[i]["pro_FIP::_id_FEC"]
        });
    }
    

    It works with spaces too. If you have pro_FIP _id_FEC as a property the same syntax will work. i.e allFEC[i]["pro_FIP _id_FEC"]