Plataan - Microsoft Dynamics - Learning & Competence Management Vincent Bellefroid Koen Stox Steven Renders Conny Schuddinck Steffie Alexiou
A blog about Microsoft Dynamics
Home Archives Subscribe Plataan website

« Sure Step Spring Release 2009 | Main | Key Tips: CTRL-F10 shortcut in NAV 2009 »

22/04/2009

More about Group containers in NAV 2009

Something interesting about Group containers in Pages in Dynamics NAV 2009 came to my attention, and I thought why not share it?

When designing page objects in NAV 2009, you can use Group containers to group fields together. This way you can somehow control where fields should be shown on a page and you can group them together.

But a Group container also has some very interesting properties like for example: Visible and Enabled. Ok, that's not so special you might be thinking…

è But heres the clue: as from NAV 2009 these properties can be set as the result of an expression.

What does this mean?

You are now able to "play" with the visible and enabled property for a group container via C/AL code. This way you can enable or disable a group of fields in 1 go.

The following is valid for the Page properties:

  • Visible
  • Enabled
  • Editable

For example in the Customer Card Page:

Add a Group container around the fields Address and Address2:

Create a Global Boolean variable BAddressgroupVisible and assign it into the Visible property of the Group:

In the C/AL code, for example in the OnAfterGetRecord trigger add the following code:

Result: the fields are shown:

Now assign FALSE to the Boolean:

Result: the fields are not shown:

Very interesting, isn't it?

As you can see, you instead of using a Boolean variable, you could let it depend on a field from the table. As a consequence the fields will then be shown for some records and not for others.

There's a little trick you need to apply if you use a variable. In the properties of the variable you need to put the property IncludeInDataset to Yes:

If you don't do that then you will get the following error message at runtime:


Remark:

  • The IncludeInDataset property defines that the variable will be added to the DataSet of the Page.
  • The Visible and Enabled properties can only be set from fields contained in the DataSet of the Page.

Comments

I was playing around with this too, but what I was a bit "concerned" about was the layout of the fields if the group is a fasttab. If you set the boolean variable to TRUE OnInit, then the fields in the fasttab group are split correctly. However if you start with FALSE and then show the group via an Action, then the fields are only in a single column, as opposed to split in two as is standard. This might not be an issue when you are setting show/hide via a db setting, but I think the single column issue might be a bug of sorts.

The comments to this entry are closed.

October 2011

Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Plataan Community

Visit us on LinkedIn Visit us on Facebook Visit us on Twitter