I am using NAV 2009 SP1, and developing a page for the RTC.
I am using an expression (a boolean variable) to hide/show a menu item (using VISIBLE property) in the "Related Information" menu. Everytime a new record is fetched, I update the boolean variable in the OnAfterGetRecord() event.
For example, when the form opens the boolean variable is set to FALSE, and the items is not shown. When I navigate to the next record, the variable gets set to TRUE, and the item shows up. Everything works fine till this point. The problem occurs when I move to the previous record again - the variable gets set to FALSE (as it should), but the menu item is still visible, and remains visible until the form is closed.
I tried setting the ENABLED property instead of the VISIBLE property for the menu item, and it works as it should (gets enabled when the boolean variable is TRUE, and vice versa). But something seems to be wrong with the VISIBLE property.
Has anyone faced something like this? Any solutions are welcome!
Thanks,
Kirtan.
0
Comments
Visible property work differently in RTC.
Just go through page id. 1 (Company Information).
Check the Property fiel of the boolen fields (IncludeInDataset).
May be this should solve you problem.
Manish
But, I know how to use the Visible property (creating a boolean variable, and setting the IncludeInDataset property, binding that variable to the relevant property of a control).
I am doing it correctly. The menu item remains hidden initially. But, once it becomes visible while traversing other records, it doesn't get invisible again.
You can try this scenario yourselves -
Modify the customer card page by adding a menu item to it (set the RunObject property to open any list page, etc.). Create a boolean variable, set the IncludeInDataset property of that variable, assign it to the menu item's visible property. Set the value of the boolean variable in the OnAfterGetRecord() event of the page -
What this piece of code will do is set the Visible property of the menu item dynamically based on the value of the Location Code field.
Run the customer list, and select a record where the location code is "Yellow". You'll observe that the menu item remains invisible. Try traversing using Ctrl+PgUp/Ctrl+PgDn and go to a record where location code is not "Yellow". The menu item becomes visible. Now, when you traverse to the previous records where the menu item was invisible, you'll observe that the item is still visible!
This, in detail, is the problem I am facing. I don't know whether this is by design, or a bug in Microsoft's code.
Kirtan.
Bruno
http://blogs.ittoolbox.com/erp/smb
Kirtan.
Kirtangor, I hope you don't mind me posting my issue here. I don't want to hi-jack your thread but I think this is a similar issue so I posted in here rather than creating a new thread. Please let me know if that's not OK. And if anyone has a solution or knows where I'm going wrong, please let me know.
Thanks!
I have also written same type of code for a group box in a page; I am hiding/showing it on the basis of an option-based dropdown list. Its working perfectly for me.
I am using NAV 2009 SP1. Which version are you using?
Kirtan.
TVision Technology Ltd
That's a good idea. I'm on NAV 2009 SP1, build 6.0.29626.0. I checked partnersource and I don't see any other hotfixes or updates to NAV after 2009 SP1.
Just in case I'm doing something stupid, let me explain exactly what I've done.
My page has a global boolean variable IsControlVisible {IncludeInDataset = Yes}. I've assigned this variable to the Visible property of the text box. I set the variable based on the selection of the combo box in the OnOpenPage function. This works perfectly. When the page opens, the text box is shown or hidden as it should be. Next, I added the same code to the OnValidate() function of the combo box control. When I change the combo box selection, nothing happens. I put a message box in the code to confirm the value of the boolean variable and it is correctly updating to true or false as it should. Is there anything wrong with this? I guess my main concern is whether the visible property of the control is taken into account at times other than the OnOpenPage() function. From what I can tell, it seems that NAV sets the property when the page opens and never looks at it again. Any suggestions would be greatly appreciated!
I had done this with a group box, and it works fine that way. You can take a look at the code that I have appended to this post.
In the code example, the page is bound to the Resource table. When the type of the resource is set to Person, it will show the City group box, else it will hide it. As you will see, the City textbox itself does not hide/shown when the type value changes.
Kirtan.
https://mbs.microsoft.com/knowledgebase/search.aspx
And an example hotfix download.
http://support.microsoft.com/hotfix/KBH ... num=982140
Unfortunately, I've also found kb969016 and it says 'Broken As Designed'. :x
PS: Direct link to KB canned as some MS reps are idiots.
TVision Technology Ltd
Well, confirmed that Expressions for Properties do work on Lists and Cards, it does not work for CardParts on the Role Center Page.
Ewald Venter