Thursday, February 23, 2012

AllowEdit setting for all form datasource fields

 
void  AA_editSales()
{
    SysDictTable dictTable = new SysDictTable(tablenum(salestable));
    Counter      i;
    fieldId      fieldId;
    ;
    salesTable_ds.allowCreate  (false);
    salesTable_ds.allowEdit    (salesTableForm.editHeaderAllowed());
    salesTable_ds.allowDelete  (false);
    
    if (salesTableForm.editHeaderAllowed())
    {
        for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
        {
            fieldId = dictTable.fieldCnt2Id(i);
            switch (fieldId)
            {
                case fieldnum(salestable,URL):
                
                    SalesTable_DS.object(dictTable.fieldCnt2Id(i)).allowEdit(true);
                    break;
                default:
                    SalesTable_DS.object(dictTable.fieldCnt2Id(i)).allowEdit(false);
            }

        }
    }
    
}