How to Fetch Data Quickly From Tables

By | January 11, 2018

While coding in any programming language, we often use loops like for,while etc. Basically, loops are performed in two cases:

* Read loops on database tables or joins.
* Loops on index values or on a list of values.

Sage X3 provides two special key words to fetch the required data more quickly. Two of them are as follows:

1. First : It is used as a read or update option to define the first record in the key order.

For eg., Below Sales order ‘SONDE0110031’ has three lines. We have fetched first line.

Kindly refer fig. FirstRecordOut for the same.

Fetch Data Quickly From Tables

fig. FirstRecord       


First Record Output

2. Last :  It is used as a read or update option to define the Last record in the key order.

For eg., Here, we have fetched the last record from the same sales order as above.

Last Record


Last Record output

Thus, we can fetch the very first and last record from the table using respective key words.

Hope this helps!


About Us

Greytrix is a one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix has some unique solutions of Sage X3 integration with Sage and Magento eCommerce along with Sage X3 migration from Sage 50 US, Sage Pro and QuickBooks.  We also offer best-in-class Sage X3 customization and development services to Sage business partners, end users and Sage PSG worldwide.

For more information on Sage X3 Integration and Services, please contact us at We will be glad to assist you.