Monday, April 6, 2015

Confusion over editable property : TRUE/FALSE or YES/NO

In MS Dynamics NAV Editable and Enable fields properties represent different values in different places. 

As an example if you go to the property of the page and editable field it is set as <YES>
Plus this is a option property where you won't be able to assign a boolean value for the field and control the editability of the page using the particular boolean value. 


This is how it looks the Table Property


For a field in a page, Editable property is set as <TRUE> and you can set a boolean value to the property and control the field editability by controlling the boolean value. 
This is how it looks in the field property

 Is this something Microsoft did intentionally or is it a mistake?

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

4 comments:

  1. Hey,
    Yes it was done intentionally.
    If you remember the good old days of NAV 2009 we can set editable, enable, visible on Forms using Form.FieldName.Editable := TRUE.. Kind of

    If MS would have made it Yes or NO we would not able to change these properties at run time. now with TRUE and FALSE we can change the field property on pages at run time based on a Boolean variable.

    For a sample you can have a look on Item Tracking page where different fields are visible based on type of transaction that you are doing.

    Hope its clear that its a feature not a mistake. :)

    ReplyDelete
  2. This is not a mistake at all. Table Field property Editable is not meant to be set dynamically through code and variables. On the other hand, Page Field property Editable can be set dynamically.

    ReplyDelete
  3. That is the reason I put the question as "was this intentional". :)
    My view is, this should have been standardized throughout the system. If Microsoft can make all the places set to true or false, it would have been nice. They can use options field where they want to restrict the usage of variables.(My personal view).

    ReplyDelete
    Replies
    1. But it is standardized. Boolean properties that can be set dynamically have TRUE/FALSE values. Boolean properties that are static have values Yes/No. If you want to make some field editable in some cases and not editable in other cases, then you will leave its Editable property on table level set to Yes and create logic for changing editabilty on form/page level via expressions/variables/functions. And that's the way it should be done in any system, not just NAV.

      Delete