Sorting .count() by something other than ID

Sorting .count() by something other than ID

Hi Guys,

Hope you can help as I’ve spent hours on this and still have no solution.

I have a picklist in Form A that brings in a number of separate records based on Form B depending upon their particular status. These records are then selected in the Form A picklist and when submitted they are given a reference number from 1 to however many records are selected which populates a field back in Form B.

This is all working great apart from one thing. When the records are counted using the .count() function (on Success) they are assigned the sequential numbers based upon their ID number. This occasionally throws the sequence of the records numbers out (as the ID numbers aren’t necessarily sequential) and I want the Form B records numbered based upon the Date_Added NOT the ID.

In a nutshell is there any other way of changing how these records are sorted prior to being numbered? Here’s the script…

===========================================================

if (input.Form_A_Status  =  "Queued")
{
    for each EW_Select cal in Form_A [ID = input.ID]
    {
        cal.Form_B_Current_Status = "Queued";
        cal.Form_B_EC = "Picked-1";
        cal.Form_B_EW_No = input.Form_A_No;
        cal.Form_B_EW_ID = input.Form_A_ID;
        cal.Form_B_EW_Tube_No = Form_B[Form_B_EW_No = input.Form_A_EW_No].count();
    }

===========================================================

EW_Select is the picklist field in Form_A and the first four cal. are working fine it’s the last line where I need the records sorted by Added_Time not ID.

I would really appreciate some help.

Cheers