In Memory Form Tables

Every form that has the ability to load and save data from the application server uses in-memory tables. Those tabels keep for every opened form an image of the data as they manipulated in the form. The following code example illustrates the use of those tables.

At form opening the usage is:

proc Form_Start()

     f = TopForm()
     p1 = PByName(f,"MAIN_REC")     {...the "master" frame of the form}
     t1 = TByName(p1,"MAIN_REC")    {....the "maste" in-memory table of the form}
     p2 = PByName(f,"DETAIL_REC")    {...the "detail" frame of the form}
     t2 = TByName(p2,"DETAIL_REC")   { ....the "detal" in-memory table of the form}

    uval = TGetFld(t1,"MAIN_REC")        {....a field's value of the form}
    count2 = TRecordCount(t2)   {...the count of "detail" records that are loaded on the form}


Before the form is closed the usage is:

fun Form_BeforeClose()

     { some detail fields in an AutoScript array}

     count2 = TRrecordCount(t2)     {....get the new record count}
     call TFirst(t2)
     for i = 1 to count2

         name[i] = TGetFld(t2,"NAME")
         comm[i] = TGetFld(t2,"COMM")

         call TNext(t2)

After the form contents has been saved the usage is:

proc Form_End ( uvalue )

       {........the t1, t2 has no meanig here use only values saved in variables!!!!}
       {........there are no in-memory tables in this section!!!!}
       for i = 1 to count2

call some_procedure ( name[i], comm[i],....)