Skip to main content
16-Pearl
February 13, 2023
Solved

For Each function not found on thingworx

Hi Everyone,

 

I am trying to call the forEach(myFunction) {

}

 

But I keep getting this error: : TypeError: Cannot find function forEach in object com.thingworx.types.InfoTable@e5e813bf.

 

Is this a version issue?

Please assist me with this

 

Many Thanks,

 

 

17-Peridot
February 13, 2023

Try with following,

var infoTable = [INFOTABLE DATA];
infoTable.rows.forEach(myFunction);

2 replies

17-Peridot
February 13, 2023

Try with following,

var infoTable = [INFOTABLE DATA];
infoTable.rows.forEach(myFunction);
Translate
17-Peridot
February 13, 2023

Hello,

 

To extend on @Sathishkumar_C's answer:

 

This error indicates that you are trying to use the forEach function on an object which doesn't contain this function.

My experience is that it is mainly used on arrays, and if you are trying to use it on an infotable, the array is called "rows" as explained in Kumars post.

 

It does however seem to be possible to use it on objects, it is just not commonly used.

 

Regards,

Jens

Translate