Options

Dynamic Expressions for Control Properties

kirtangorkirtangor Member Posts: 65
edited 2011-05-16 in NAV Three Tier
I am using NAV 2009 SP1 w/ SQL Server.

I want to set a boolean property for a control in my page.

Is it necessary that I have to create a boolean variable, set the IncludeInDataset property of that variable to "Yes", and set property value to this variable?

I have a field in my Rec variable whose value determines the value of the control's property. If Rec.Field = TRUE, then the field should be editable, and vice versa. I tried setting the Editable property to "Rec.Field", yet it is giving me an error that the field could not be found.

I also tried creating a method returning a boolean value, and setting the property's value to that method. I am getting the error mentioned below -
Error compiling dynamic control expression: 'ReturnBool()' at index '12'. The error is: Unknown function type.
Is there any way to avoid the hassle of creating and tracking boolean variables to set a simple property which could be inferred from a record's field value?
Thanks,
Kirtan.

Answers

  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    In 2009 you need the boolean variable - you cannot just type in an expression.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    kirtangorkirtangor Member Posts: 65
    Hmmm. So that's confirmed. Thanks for the reply, Freddy.
    Thanks,
    Kirtan.
  • Options
    redhotmustangredhotmustang Member Posts: 91
    So I guess this is the NAV 2009's new way to change the value of the page controls' properties.

    Step 1. Create a boolean variable which "IncludeInDataset" property is 'Yes', let's call it "Activate".
    Step 2. Access the control's properties, assign the boolean variable "Activate" to the specific property we want to change.
    Step 3. Depending on the code we write, or field's value from Rec or other record variable, we can change the value of "Activate", therefore affecting the value of the page control property to which we earlier assigned the "Activate" variable.

    That's why there aren't page control properties in the Symbol Menu, this is the new way to change them dynamically.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
Sign In or Register to comment.