Expand All Always on Page
-
Expand All Always on Page
Posted by David Wiser on October 6, 2017 at 7:54 pm-
Certain pages, such as the Item Availability by Event, have subforms which have lines groups and condensed. When the page is open, the default is that the lines are collapsed. Is there a setting or code that can be added to a page to have it open in the “Expand All” view as opposed to collapsed?
——————————
Dave Wiser
Controller
Beckwith & Kuffel
Seattle WA
—————————— -
Ramin Marghi
MemberOctober 7, 2017 at 1:49 AM
Hi Dave,This one’s actually a fun one — based on what I gather, the “Expand All” action in the ribbon is an exclusive to these ShowAsTree pages and the only way to properly expand all is to use the action in the ribbon (binaries) which have no C/AL code trigger.
However, if you can perform anything with your keyboard, then we can get C/AL to do the same using a nifty method called SendKeys.
A video showing this in action is below:
YouTube – SendKeys DemoIn essence what we’re doing is using the Windows Script Host to send keyboard strokes to your NAV application in the order of:
1) F10 (to bring up the ribbon shortcut tooltips);2) H (for the Home tab);3) E (for Expand All);What I did is create a local function called “AutoExpand” with two variables: one an Automation type called WshShell (Subtype of ‘Windows Script Host Object Model’.WshShell) the other a Text variable called KeyStrokes.
The function itself is quit simple, first setting the KeyStrokes to F10 + H + E, using the syntax that the Windows Script Host documentation calls for, then it basically “runs” the automation with those keystrokes:
Finally, you want this to run every time you set any of the filters on the page, so basically in each of the OnValidate functions for those filter fields, you call the AutoExpand function (example below is the Item No. Filter):
Et voila! Auto-expanding of the tree.You can pretty much do this for any keyboard ‘macro’ type functionality within NAV.
One very good use-case is toying with your data-entry colleagues for Halloween by having a function type out “HELP – I’M THE GHOST OF A VOID CHEQUE TRAPPED IN NAV” in the Description lines of documents when they insert a new line…
…on second though, that may get old very fast. 🙂
——————————
Ramin Marghi , CPA, CGA
CPA, CGA | ERP Consultant
Catapult ERP
VANCOUVER BC
——————————
——————————————- -
I followed your instructions and am getting the following error when trying to save the object after adding the “AutoExpand;”? to one of the OnValidate triggers:
What did I do wrong?——————————
Dave Wiser
Controller
Beckwith & Kuffel
Seattle WA
——————————
——————————————- -
Ramin Marghi
MemberOctober 20, 2017 at 12:16 PM
Hi Dave,I think you may have put the Variables in the Parameters tab of the function options — they should be in the tab below and the Parameters tab should be empty:
——————————
Ramin Marghi , CPA, CGA
CPA, CGA | ERP Consultant
Catapult ERP
VANCOUVER BC
——————————
——————————————- -
Bingo. That did it. I also added it to the OnOpenPage trigger and now it auto expands when the page first opens. Thanks a lot for the help.
BTW, this is the first time I use the @ name function. Did you get an email or just a notification in your NAVUG inbox??? Just curious.
——————————
Dave Wiser
Controller
Beckwith & Kuffel
Seattle WA
——————————
——————————————- -
Ramin Marghi
MemberOctober 20, 2017 at 2:01 PM
Glad to hear it’s working now!— I got an e-mail notification (which is actually pretty awesome!)?
——————————
Ramin Marghi , CPA, CGA
CPA, CGA | ERP Consultant
Catapult ERP
VANCOUVER BC
——————————
——————————————- -
It is pretty awesome.
Are going to Collaborate Canada in Vancouver on 11/29? I will be up there that day also. Hope to see you there.
Thanks again?.
——————————
Dave Wiser
Controller
Beckwith & Kuffel
Seattle WA
——————————
——————————————- -
Ramin Marghi
MemberOctober 20, 2017 at 2:09 PM
?, I sure am — I’m actually one of the presenters! See you there!——————————
Ramin Marghi , CPA, CGA
CPA, CGA | ERP Consultant
Catapult ERP
VANCOUVER BC
——————————
——————————————- -
Interesting, I thought if you saved the page as ExpandAll (expand all tabs) in configuration, then all the tabs stay – expanded.
——————————
Meenakshi Singh
Manager of Business Applications
Home Market Foods, Inc.
Norwood MA
——————————
——————————————-
David Wiser replied 7 years, 2 months ago 1 Member · 0 Replies -
-
0 Replies
Sorry, there were no replies found.
The discussion ‘Expand All Always on Page’ is closed to new replies.