Options

How to find out the field is set to "editable=no"

itspeteritspeter Member Posts: 105
Hi,

How do I find out the field in a table is set to "editable=no" by using C/AL code?

Thanks.
Regards,
Peter Ng

Comments

  • Options
    JedrzejTJedrzejT Member Posts: 267
    Hi

    ::First

    IF Record.FIELDACTIVE(Record.Field)=FALSE THEN
    MESSAGE('This field enabled=false')

    ::Second

    recref.OPEN(TableNo);
    FOR Counter:=1 TO recref.FIELDCOUNT DO BEGIN
    IF recref.FIELDEXIST(Counter) THEN BEGIN
    fldref:=recref.FIELD(Counter);
    IF fldref.ACTIVE THEN
    MESSAGE('This field enabled=true %1',fldref.NUMBER)
    ELSE
    MESSAGE('This field enabled=false %1',fldref.NUMBER)
    END;
    END;

    This code is not tested, i think it works

    Regards
  • Options
    SteveOSteveO Member Posts: 164
    Enabled and editable are not the same thing.
    Enabled dictates whether or not the field is actually allowed to be used at all (in effect it dictates that this field should be ignored completely).

    I don't think you can tell whether or not a field is editable through C/AL code
    but you can determine whether or not a control on a form is editable by using
    [OK] := CurrForm.<Control Name>.EDITABLE([TRUE|FALSE]);
    If you leave out the parameters then it returns the current status.
    This isn't a signature, I type this at the bottom of every message
  • Options
    JedrzejTJedrzejT Member Posts: 267
    Sorry.. in messagebox I insert wrong text, but function should work fine

    Description from help:

    FIELDACTIVE (Record)
    Use this function to check whether a field is enabled or not.

    ACTIVE (FieldRef)
    Use this function to check whether the field that is currently selected is enabled or not.

    Both function is use to check is field ENABLED (not EDITABLE)
  • Options
    JedrzejTJedrzejT Member Posts: 267
    eh.. :oops: I mistake second time.. forgot about my posts
Sign In or Register to comment.