Skip to main content
1-Visitor
May 21, 2019
Solved

How to get certain number of rows from Infotable

  • May 21, 2019
  • 2 replies
  • 3701 views

Hello,

Is there a way by which we can get certain limited number of rows from infotable, without writing any custom service/code.

For example I have 10 rows in my infotable, and I want first 5 rows, is there any service available which I can use to get that?

Thanks in advance

Regards

Aditya Mittal

Best answer by zyuan1

Hi, you can get a limit number of rows by controlling the Maxitem in the infotable query services, or add a snippet to the existing infotable result:

 

var params = {
maxItems: undefined /* NUMBER */,
t: undefined /* INFOTABLE */
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].TopN(params);

2 replies

20-Turquoise
May 21, 2019

You could probably set your query to max rows 5. Other than that, we don't have any specific out of the box service available for this use case.

amittal11-VisitorAuthor
1-Visitor
May 22, 2019

Hello,

Thanks for your reply. I would like to know how to write a query to get the maximum number of rows from a infotable. Even using a query will work for me, because in any case I am using a query on my infotable, so I can add one more parameter for Max rows, that is fine for me. I usually refer following link whenever I have to write a query:

https://support.ptc.com/cs/help/thingworx_hc/thingworx_7.0_hc/index.jspx?id=QueryParameterforQueryServices&action=show

If there is some other reference, please share, it would be helpful.

Many thanks

Regards

Aditya

zyuan15-Regular MemberAnswer
5-Regular Member
May 22, 2019

Hi, you can get a limit number of rows by controlling the Maxitem in the infotable query services, or add a snippet to the existing infotable result:

 

var params = {
maxItems: undefined /* NUMBER */,
t: undefined /* INFOTABLE */
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].TopN(params);