Please let me know how can I add above context log with correct syntax.
context.log("START - for loop to push data to array");
for(let i = 0; i < floors.items.length; i++) {
let item = floors.items[i].data;
let itemFloornumber = item.floorNumber + 1;
let floorNumber = "";
//Positive number between 0 and 9
if(itemFloornumber < 10 && itemFloornumber >= 0) {
floorNumber = "0" + itemFloornumber;
//Negative number between -1 to -9
} else if(itemFloornumber < 0 && itemFloornumber > -10) {
floorNumber = "0" + itemFloornumber * -1;
//Negative number less than -9
} else if(itemFloornumber <= -10) {
floorNumber = "" + itemFloornumber * -1;
//Positive number bigger than 9
} else {
floorNumber = itemFloornumber;
}
if(typeof(types[item.floorType]) != 'undefined') {
floorNumber += types[item.floorType];
}
if(itemFloornumber <= 0) {
floorNumber += types['Negative'];
}
//SQL, not hard code
let bygningsnummer = buildings.filter(building => building.daluxid == item.buildingID)[0].ISYEnummer;
procedureData.floors.push({
DaluxEtasjeID: item.id,
DaluxBuildingID: item.buildingID,
Etasjenummer: floorNumber,
Bygningsnummer: bygningsnummer,
Bygningsnavn: item.buildingName,
Etasjenavn: item.name,
BTA: item.grossarea,
NTA: item.netarea,
hoyde: item.height,
DaluxSistEndret: item.lastChange
});
}
context.log("END - for loop to push data to array");
I want to add some context log traces into the for loop before line
let item = floors.items[i].data;
The context log traces should look something like this, syntax might be wrong
if (floors.items[i] == null))
context.log(‘floors.items[i] == null. i = ${i}’)
else if (floors.items[i].data == null)
context.log(‘floors.items[i].data == null. i = ${i}’)
else
context.log(item)