cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Any shortcut to get infotable length quickly

AP_10343008
15-Moonstone

Any shortcut to get infotable length quickly

We fetched 5000 rows and 4 columns from sql db in 40seconds.

Then In Thingworx code, if i used InfoTable.length to find total number of rows in table is taking additional 20seconds. 
Any other shortcut to get table length quickly.?

Query:

SELECT distinct a.cmp , a.engseq , a.it,  null as totalrows

FROM ENGINEERING a 

WHERE a.MODEL like 'R24R%' 

AND a.cmp not in ( 

select cmp 

from ENGINEERING

where MODEL like 'R23R%' ) ;

 

 

ACCEPTED SOLUTION

Accepted Solutions
Velkumar
19-Tanzanite
(To:AP_10343008)

Hi @AP_10343008 

 

You can try 

 

 

infoTable.rows.size()

 

 

 but I'm not sure whether it will improve performance. Please do a comparison between the size and length

 

For 5 Rows of Data, Size() runs faster than the length method

 

Velkumar_0-1696410753119.png

 

 

Difference between Size() & length - https://www.geeksforgeeks.org/what-is-the-difference-between-array-size-and-array-length-in-javascript/

 

/VR

View solution in original post

3 REPLIES 3
Velkumar
19-Tanzanite
(To:AP_10343008)

Hi @AP_10343008 

 

You can try 

 

 

infoTable.rows.size()

 

 

 but I'm not sure whether it will improve performance. Please do a comparison between the size and length

 

For 5 Rows of Data, Size() runs faster than the length method

 

Velkumar_0-1696410753119.png

 

 

Difference between Size() & length - https://www.geeksforgeeks.org/what-is-the-difference-between-array-size-and-array-length-in-javascript/

 

/VR

I find it strange that infoTable.length would take additional 20 seconds, if run just once.

Can you share all the service code where you observed this situation?

    let queryA = "sql query........";
    result = Things['SmartParts.DataBaseConnector-TH'].Query({
        inQuery: queryA
    }); 
 
  //if temp infotable used to calculate length, then it is taking some more time to give results. SO using same result infotable
    let count =result.rows.size();
    if(count>0) result[0].COUNT=count;
    else result[0].COUNT=0;
Announcements


Top Tags