Retrieving Records from a Database - View in Descending Order?

C

c9ola

I have a button that retrieves records for me. On the 'Rules' I chose 'Query
using a data connection: tbl_AccRpt Main Connection.'

It works fine, the records come in as expected, but it puts the
latest/newest entry at the bottom, the oldest at the top. I'd like it to be
the opposite. Start with the latest record at the top and go down to the
oldest. Is there a way to change to order of how the retrieved records are
displayed?
 
C

Clay Fox

By default InfoPath loads the records in the order they are in the table,
which typically is from first to last.
To change this,
Modify your main data connection and in the lower right will be a Edit SQL
button which you can use to change the sort. add an Order by to the end of
the select statement and specify which field to sort it by.

If you are looking at developing enterprise form solutions with a database
at the backend i would recommend you check out the Database Accelerator web
services suite. This allows you to query and submit multiple tables instead
of only one as the default Infopath form allows. http://www.qdabra.com
--
Thanks

Clay Fox

Qdabra Software
http://www.qdabra.com

InfoPathDev.Com
The Largest InfoPath Forum in the World
http://www.infopathdev.com
 
C

c9ola

What is the syntax? I used:
select
[AccRptID],[RowID],[Employee_Name],[Manager_Name],[Department],[Date],[Item],[Levels],[Category],[OtherCat],[Customer],[OtherCust],[TimeEst],[HotTopic]
from [tbl_AccRpt] as [tbl_AccRpt] OrderBy [AccRptID] Desc

It is giving me an unsuccessful error (syntax error in FROM clause).
 
C

Clay Fox

You need a space between order and by. I think that is the issue.
--
Thanks

Clay Fox

Qdabra Software
http://www.qdabra.com

InfoPathDev.Com
The Largest InfoPath Forum in the World
http://www.infopathdev.com


c9ola said:
What is the syntax? I used:
select
[AccRptID],[RowID],[Employee_Name],[Manager_Name],[Department],[Date],[Item],[Levels],[Category],[OtherCat],[Customer],[OtherCust],[TimeEst],[HotTopic]
from [tbl_AccRpt] as [tbl_AccRpt] OrderBy [AccRptID] Desc

It is giving me an unsuccessful error (syntax error in FROM clause).
--
krh


Clay Fox said:
By default InfoPath loads the records in the order they are in the table,
which typically is from first to last.
To change this,
Modify your main data connection and in the lower right will be a Edit SQL
button which you can use to change the sort. add an Order by to the end of
the select statement and specify which field to sort it by.

If you are looking at developing enterprise form solutions with a database
at the backend i would recommend you check out the Database Accelerator web
services suite. This allows you to query and submit multiple tables instead
of only one as the default Infopath form allows. http://www.qdabra.com
--
Thanks

Clay Fox

Qdabra Software
http://www.qdabra.com

InfoPathDev.Com
The Largest InfoPath Forum in the World
http://www.infopathdev.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top