How can I fetch records within a given range

How can I fetch records within a given range

To fetch records from a Form within a given range, specify the start index and end index range in the Fetch records task, as shown in the sample code below. Here, the first five records that are sorted by Added_Time field will be fetched from the Contact form.  You can add the script to the  Form Actions ->  on add -> on success block to fetch records when a new record is submitted to the database. 


rec = Contact [ID != 0] sort by Added_Time range from 1 to 5;

where,

rec it is the name of the collection variable that contains form data.

Contact name of the form whose data has to be fetched. 

[ID !=0] is the criteria expression.

sort by Added_Time - the field based on which the records will be sorted. Here, Added_Time is the Deluge variable, which returns the time when the record was added. 

range from 1 to 5 - range enables you to limit the records fetched within the start index (x) and end index (y). If range is not specified, all the records in the form that satisfy the given criteria, will be fetched.


In the Script Builder UI, drag-n-drop the Fetch Records task and click on 
Edit, to specify the Sort column and Range in the Fetch records dialog, as shown in the screen-shot given below:



The Edit dialog to specify the sort field, the sort order and range will be displayed. Specify the values and click Done.