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 recordstask, 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 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 is 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.