For loop not working properly
Hi everyone,
I'm trying to do a simple for loop to get some fields from getimplementingthingswithdata into another property to be used in a collection.
When I execute the following code without the For loop, it works fine. But I can't seem to get the for loop working.
Can anyone help me figure out what is wrong with my code?
the var result is declared earlier in the code.
// result: INFOTABLE dataShape: "RootEntityList"
let sites = ThingTemplates["BALL.Sites_ThingTemplate"].GetImplementingThingsWithData();
let tablelenght = sites.rows.lenght;
for (let x = 0; x <= tablelenght; x++) {
// SitesCollec_datashape entry object
let newEntry = {
Site: sites.rows[x].name, // STRING [Primary Key]
Location: sites.rows[x].description, // STRING
Img: sites.rows[x].ImagemPlanta, // IMAGELINK
ICL: sites.rows[x].ICL, // NUMBER {"minimumValue":0,"maximumValue":100}
EficienciaDQO: sites.rows[x].EficienciaDQO, // NUMBER {"minimumValue":0,"maximumValue":100}
EficienciaFluoreto: sites.rows[x].EficienciaFluoreto, // NUMBER {"minimumValue":0,"maximumValue":100}
Indicador4: undefined // NUMBER
};
result.AddRow(newEntry);
}
me.implemSites = result;

