I’ve recently managed to free up some time to start thinking about M3, JScripts and some of the new shinys that we purchased last year, namely Mashups, LES and DAF.

So what I have recently been tinkering with is Mashups and though a few things have been a little disappointing, others are very kewl.

Let me say, if you delving in to the world of Mashups, take some time to learn a little about WPF and XAML. You can download Microsoft Visual Studio 2010 or higher and create WPF projects and see how XAML works when dealing with controls and layouts.

Using XAML is fantastic – there is a lot of power you can tap in to and there is a vast amount of resources available on the web about doing innovative things with WPF and XAML and by extension Mashups.

I’ve been tinkering with two different ideas, getting data in to a Mashup from a WebService (more on that in another post) and creating a nice easy way for a user to select a customer, then an order and see the order lines of that order.

So, in order to ease the leg-work a little I used the List and Edit template from Lawson, this gave me a list of the customers which you could select and it will provide some key details for you to edit.

Using that as a basic, it was pretty easy to create a new MIListPanel calling the M3API OIS100MI::LstHead and link the CUNO together. Then it was pretty easy to create another MIListPanel and populate that by calling OIS100MI::LstLine and linking on the ORNO.

This yields something like this:

Which is pretty nifty – something useful created in a very short period of time.

However, having been a user there are a few things which would annoy me.

1). Order Date is eating more real-estate than it should for no good reason. 2). The Order Numbers aren’t in order.

Formatting the Order Date

So we don’t like seeing the time added on to the order date, it’s not really relevant and we’ll the time component isn’t populated anyway. So what I’d like to do is set it up so it removes the time component AND lines up the dates.

It’s been a while since I played around with XAML directly, but my googlefu was working. We need to set the StringFormat in our DisplayMemberBinding to something a little more friendly.

Checking our XAML the Mashup created we have the following entry:<GridViewColumn Header=”Order date”DisplayMemberBinding=”{Binding [ORDT]}” />

Now means that we get rid of the time component and the string format is going to always be 10 characters – so it will line up nicely in the column. Some of you may wonder why I didn’t just do<GridViewColumn Header=”Order date”DisplayMemberBinding=”{Binding [ORDT], StringFormat=d }” />

That would be because on days < 10 the date string will only be 9 characters in length – which means the date won’t line up.

Changing the Sorting Order

Normally this would be pretty straight forward, we’d have a little XAML and a little bit of code in the background – however mortals like me don’t have the tools to add the code 😦

9 Responses to Mashups: Orders for a Customer – Sorting on the Order Number

Hi Scott. Welcome back to posting. I like the Sort sample. Does it work on the result set (for example the top 100 records which is the MI default) or on the entire M3 table? In other words, is the sorting done server-side or client-side? Do you know?

Thanks, it’s good to get some posts back underway and to spend some time in the M3 world again.

Unfortunately the sorting is only done on the client-side. So if you are only getting 100 records at a time then confusion will ensue.
In this example I did set the customer list to be 9999 records so that is always an option 😉

The other thing that I have been investigating (however encountered a ‘bug’ with Mashups?) is wrapping an SQL query in a Webservice. The query itself will define the sorting.

Hi Scott. More good stuff. Looking at the post you reference, have you got the filtering aspect working as well? It would be really useful to pull data back from an API call, then filter based on the output fields.

filtering – I have vague recollections of a lady from Microsoft who was involved in the early design or at least demonstration of WPF who did some filtering in pure XAML. I’ll need to find her website again.

You can always reload the data with the filters applied, not terribly efficient – this is something that I am working on with a webservice at the moment and got running with a vital clue provided by an Infor staff member. I just plan to clean it up, refactor and then post.

And I am sure I saw something about filtering in Mashups Designer – I’ll need to take another good look there.

The ladies name was Bea Stollnitz – http://www.zagstudio.com/ there is lots of interesting XAML stuff in there, a lot backed with code but still useful to know. I’m pretty sure buried somewhere there was a pure xaml filter example…

The MIListPanel is an IEnumerable property called “Items”, it also has a property called ListControl – assuming it’s the same as the MForms ListControl then it will point to a ListView from which you can get the .Items property.