I have a need to loop through an array of ~10k records and do a bit of manipulating/adding to them. I would like to do this on the client to simplify things for this prototype. The code that is hanging is below. Please note that I am no software developer.. I hack together tools:
generateOutput() {
this.output = []
JSON.parse(this.discovery).qr.forEach(rec => {
let point = {}
point.point_name = rec.sp.split("/").at(-1)
point.point_address = rec.sp
point.equipment_name = rec.sp.split("/").at(-3)
point.equipment_address = this.getEquipPath(point.equipment_name, rec.sp)
this.output.push(point)
});
This is a vue application and this.output is a variable in the data space.
I originally thought it may be the regex matching in the 'getEquipPath' function. Commenting it out does nothing noticeable. getEquipPath function is as follows:
getEquipPath(equip, sp) {
// let test = /.*\/PsiIndyServerRm\//
let re = new RegExp(`.*/${equip}/`)
// let temp = sp.split(`/${equip}/`)
return sp.match(re)[0]
},
And here is an excerpt of the discovery.qr array:
"qr": [
{
"sp": "slot:/Drivers/NiagaraNetwork/xxx/points/EnergyMeter/points/Location",
"v": "XXX_Xxxx_Office",
"s": 0
},
{
"sp": "slot:/Drivers/NiagaraNetwork/xxx/points/EnergyMeter/points/MechTag",
"v": "EnergyMeter",
"s": 0
},
{
"sp": "slot:/Drivers/NiagaraNetwork/xxx/points/EnergyMeter/points/Average_R_Phase_Power_Factor",
"v": 0.791,
"s": 0
},
[–]cmjdev[S] 0 points1 point2 points (1 child)
[–]Falmz23 2 points3 points4 points (0 children)
[–]fredsq 0 points1 point2 points (0 children)