Platform
Learn
Community
Support
Partner Center
Sign up
or
Log in
logout
Account Settings
Profile
messages
Messages
logout
Logout
Platform
Home
Downloads
IPP
Licensing
Project Sizing
Learn
Training
Documentation
Evaluation Guide
What's New
Community
Home
Forums
Forge
Ideas
Members
Support
Partner Guide
Resources Library
Opportunities
Account Management
Sign up
or
Log in
Home
Forums
Forge
Ideas
Members
Dear ,
What would improve your OutSystems Community experience? Let us know by taking this 2-minute survey.
Pick up the survey
Community
›
Forums
›
Technology & Integration
Advanced Query Max Records
Community
›
Forums
›
Technology & Integration
Advanced Query Max Records
New Post
New Post
Alexandre Alves
Posted on 2008-10-21
Alexandre Alves
Rank: #4392
Posted on 2008-10-21
How to implement the Simple Query Max Records in an Advanced Query, for pagination proposes?
Thanks in advance.
André Vieira
Posted on 2008-10-21
André Vieira
Rank: #1
Posted on 2008-10-21
Solution
Hello Alexandre,
First of all welcome to our community.
In an advanced query you'll need to add an input parameter to the query with the expand inline parameter set to true and that you use to filter the number of results according to the Database system you're using.
SQL:
select TOP @MaxRecords {User}.* from {User}
Oracle:
select {User}.* from {User} where ROWNUM <= @MaxRecords.
I hope this helps, Cheers,
André
Solution
Alexandre Alves
Posted on 2008-10-22
Alexandre Alves
Rank: #4392
Posted on 2008-10-22
Solution
Hello André.
Thank you for your answer.
As you said, I added an input parameter to the query with the expand inline parameter set to true and the value "trQuotes.StartIndex + trQuotes.LineCount + 1" but now it returns me an error when I click Verify:
"Unexpected DISTINCT in SQL Statement".
Even doe, when I click Test it returns the error:
"Incorrect syntax near the keyword DISTINCT. Incorrect syntax near ')'"
I even tried to put the input parameter value to 10, but it's just the same.
My advanced query is:
SELECT TOP @MaxRecords DISTINCT {QUOTE}.[QuoteId], {QUOTE}.[CreatedBy], {QUOTE}.[CreatedOn], {QUOTE}.[CustomerName], {QUOTE}.[Status], {QUOTE}.[TotalValue], {QUOTE}.[Region], {QUOTE}.[ProjectName], {QUOTE}.[ProposalId], {USER_MASTER}.[Name]
FROM {QUOTE}, {USER_MASTER}
WHERE ({QUOTE}.[CREATEDON] >= @CreatedOn OR @CreatedOn = @NullIdentifier)
AND ({QUOTE}.[STATUS] = @Status OR @Status = '')
AND ({QUOTE}.[ProjectName] LIKE '%' + @Keyword + '%' OR {QUOTE}.[CustomerName] LIKE '%' + @Keyword + '%' OR @Keyword = '')
AND ({QUOTE}.[CreatedBy] = {USER_MASTER}.[Id])
AND (({QUOTE}.[CREATEDBY] = @CreatedBy) OR ({QUOTE}.[QuoteId] IN
(SELECT DISTINCT {QUOTE}.[QuoteId]
FROM {QUOTE}, {QUOTE_ITEMS}, {APPROVAL}
WHERE {QUOTE}.[QuoteId] = {QUOTE_ITEMS}.[QuoteId]
AND {QUOTE_ITEMS}.[Status] = @QuoteItemStatus
AND ({QUOTE_ITEMS}.[DiscountRangeId] = {APPROVAL}.[DiscountRangeId]
AND {APPROVAL}.[UserId] = @CreatedBy))))
Thanks.
Solution
Quick Reply
attachment
Choose File
No file chosen
Submit
Login to reply
New Post
Available Forums
Technology & Integration
News and Announcements
Forge Discussions
Meta
Community Quick Guides
Usability
Installation Troubleshooting
Personal Environment Troubleshooting
Forum Notifications
Email Digest Settings
Loading...