Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > About Row Number / Limit

Forum

Search UsersRules
About Row Number / Limit
#1
Active user
Points:: 0
Joined:: Feb 26, 2015

Hello there,
I want to use sql limit and line number.
How can I do that?

Code
Select ..... limit, 5

or
Code
Select rank () ....

or
Code
Select rownumber () .....

...
...
or
Code
   Query = New Query;
   Query.Text = "SELECT
                |   Table1.Code,
                |   Table1.Description ////using row number or limit ??
                |FROM
                |   Catalog.Table1 AS Table1";
   
   QueryResult = Query.Execute();
   
   SelectionDetailRecords = QueryResult.Select();

Can you give an example?

Profile
#2
Guest
Points::
Joined::

Hello, Erdogan, you can add TOP clause to the query:

Code
   Query = New Query;
   Query.Text = "SELECT TOP 10
                |   Table1.Code,
                |   Table1.Description 
                |FROM
                |   Catalog.Table1 AS Table1";
   
   QueryResult = Query.Execute();
   
   SelectionDetailRecords = QueryResult.Select();

Profile
#3
Active user
Points:: 0
Joined:: Feb 26, 2015

I want to make pagination.
Can I do it any other way?

I list the records with JSON.
Too many records.
I want to divide them (Paging).
I have to use it in the query for this.

How else can I do it?

Profile
#4
Guest
Points::
Joined::

Hello, Erdogan.

Maybe you could change the behavior to something better? In most cases you can't expect that the user will click on each page of the long list. Maybe you can display a message that there are N extra items in the database so the list is not full and add a button to export entire the list?

Profile
#5
Interested
Points:: 0
Joined:: Apr 5, 2012

Hi, Erdoğan.

How I get your question, you need to get more data list in several pages that is related with row count and page maximum row count?

If question is true. You may examine an example that I prepared for you. External data processor message you how many pages can be created, will how many count in each page and totally how many rows in whole.

For that you need to open firstly 1TC:Ticaret Yönetimi + Genel Muhasebe configuration and then open data processor.

Profile
#6
Active user
Points:: 0
Joined:: Feb 26, 2015

Wonderful...
Thank you so much. :)

Profile
#7
Active user
Points:: 0
Joined:: Feb 26, 2015

Actually, I wanted to paginate.
I built a Web Store.
I list products by category.
I want to paginate it.

Pagination can be done using TSQL and PSQL. (Ms Sql Server, IBM DB2, Oracle, MySQL). It's very simple. We just need to write in the query. I wrote the examples in my first post. In ADO components, the RecordSet object can also paginate. How can we do this at 1C? I wanted to ask.

Is there a pagination for Query and RecordSet object in 1C?
Sample ;

Code
QueryResult.PageSize
..
or
..
RecordSet.PageSize
..
or
...


If not, I can use this file.
I also did it with JSON pagination.

Profile
#8
Guest
Points::
Joined::

Pagination is implemented in dynamic lists, but i'm afraid you can only emulate it in queries by skipping the required number of rows and returning ones that match the window.

Profile
#9
Just came
Points:: 0
Joined:: May 24, 2013

Hi Erdogan, you can make pagination with sequential access like that

Code
SELECT TOP <YourPageSize>
   Table1.Ref AS Ref,
   Table1.Code,
   Table1.Description
FROM
   Catalog.Table1 AS Table1
WHERE Table1.Ref>&LastPageRef

ORDER BY
   Ref

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.