If you are playing around with WebServices in LWS Designer and the M3 Business Engine, then you will have probably have had some fun trying to figure out which field to choose.

Now there are a couple of things that you can do, you can look at the view definitions (on our AS400 they are in ROOT\QIBM\UserData\mne_data \viewDefinitions\viewDef_1412S\)and dredge through the .xml file looking for something useful or you can take advantage of the Visual Tree. (see: http://msdn.microsoft.com/en-us/library/ms753391.aspx ). As I am interested in seeing how the panels are made up in WPF terms I decided to take a more programmatic approach – it also provides a better context when reading through the Lawson MForms Developers Guide. It also gives me an opportunity to practice programming in jscript and break Smart Office – yes, I killed it a couple of times when I ran my script repeatedly 🙂

So I wrote a function called displayChildren(), it will take an object and use the VisualTreeHelper class to find any children. We will then use reflection to get the “Name” property of the object and we’ll also display the type of object. And to boot, it’s indented depending on how deep within the Visual Tree you are.

So, I mucked around with BUS100 again.

It’s a nice simple program which is ideal to experiment with.

Based on experience with WPF, at a glance I can say that this will comprise of a Grid, Combobox, ListView and within the ListView header there is a StackPanel per column. Within the first columns StackPanel there is a Label and then a TextBox.

Fairly standard sort of stuff.

Now we can look at going up the Visual Tree to the top or we can just work on from the GridView downwards. You can use this code to go upwards and investigate lots of interesting things, but for the moment and for the interest of this discussion we’ll just look at the panel.

I use the panel as the seed passed to my function displayChildren(). As you can see we have a Label Field which is called WDI0115 which is collapsed, there is also a WWDIVI field which is also Collapsed.

We don’t see the Sorting Order by default because that is at a higher level, if you decide to go from the highest level then expect to get an OutOfMemoryException (Smart Office will ask you to restart). If there are a large number of objects things quickly go south.

1.3gig of RAM seems a tad excessive given we came from 78K 🙂

Interestingly the memory used doesn’t appear to be released back to the system until you close Smart Office (even when you only do from the Grid down).
Still, something to investigate further.