Create a loop that traverses the fields and set the desired rights, e.g something like this (example done on CustTable). The method is the init of the datasource

public void init()
{
    int         x;
    DictField   dictField;
    FieldId     fieldIdExt;
    FieldId     fieldId;
    DictTable   dictTable = new DictTable(this.table());
    Set         set = new Set(Types::Integer);
    ;

    super();

    // Allowedit field list
    set.add(fieldid2ext(fieldnum(CustTable, AccountNum), 1));
    set.add(fieldid2ext(fieldnum(CustTable, Name), 1));
    set.add(fieldid2ext(fieldnum(CustTable, CustGroup), 1));

    fieldId = dictTable.fieldNext(fieldId);

    while (fieldId)
    {
        dictField   = new DictField(dictTable.id(), fieldId);

        for (x = 1; dictField.isSql() && !dictField.isSystem() && x <= dictField.arraySize(); x++)
            this.object(fieldId).allowEdit(set.in(fieldId2ext(fieldId, x)));

        fieldId     = dictTable.fieldNext(fieldId);
    }
}

You might want to create a common static method which accepts a FormDataSource and a Set as arguments...

//Lars


-----Original Message-----
From: ozanhananac [mailto:[EMAIL PROTECTED]
Sent: 2. august 2004 13:00
To: [EMAIL PROTECTED]
Subject: [development-axapta] Disabling all dataset fields except a specific one.


Hello,

I want to disable all fields of a dataset on a form, but except a
specific one.

I tried these lines:

    xxxxx_ds.allowEdit(false);
    xxxxx_ds.object(fieldnum(xxxxx,fieldName)).allowEdit(true);

but they doesn't work, because Datasource properties overwrite field
properties.

What may be the solution of this job?

Many Thanks

Ozan



Yahoo! Groups Sponsor     

ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=1297sra2o/M=295196.4901138.6071305.3001176/D=groups/S=1705006764:HM/EXP=1091534724/A=2128215/R=0/SIG=10se96mf6/*http://companion.yahoo.com> click here     
  <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=957695080>      


  _____ 

Yahoo! Groups Links


*      To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/ <http://groups.yahoo.com/group/development-axapta/>
 

*      To unsubscribe from this group, send an email to:
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
 

*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .




[Non-text portions of this message have been removed]



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to