Autonumber subform rows through deluge script

Autonumber subform rows through deluge script

Hi all,

Ive been trying to create a numbering system for each new subform row added. The problem ive come to is on add row,
it doesnt show show the value Im trying to display

Here is the code ive tried:

on Add row: 

linecount = 1;
for each item in Items_Ordered
{
    //This will autonumber each new line added in items ordered
    items.Line_Number = linecount;
    linecount = (linecount  +  1);
}

The output I'm looking for is to have each new row added contain a row number, starting at 1 and increasing by 1 each new line added


Thank You for any responses, and have a B-E-A-utifl day!

-Cory R