Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sort Grid based on a User Field

7 views
Skip to first unread message

docsis

unread,
Jun 29, 2010, 11:55:16 AM6/29/10
to
Could someone point me in the right direction. I am trying to sort the
Payment Application screens grid based on a user defined field I have opened
up as a customization.

So far I have tried using the Msort functions in conjunction with setting
the UDF as a key field with no luck. It just sorts the buit-in key field when
I call msort:

Private Sub ccustid_Chk(ChkStrg As String, retval As Integer)
Dim MemHandle As Integer
If ChkStrg <> "" Then
MemHandle = GetGridHandle("Spread1")
Call MKey(MemHandle, 0, "bardoc1.user6", False)
'Call MKey(MemHandle, 0, "bardoc1.refnbr", False)
Call MSort(MemHandle)
Call MUpdate(OrigGridHandle)
Call MDisplay(OrigGridHandle)
End If
End Sub

Steve Martin

unread,
Jun 29, 2010, 12:49:04 PM6/29/10
to

Find the stored procedure that is used for that grid and modify it to sort
based on the field that you want.

docsis

unread,
Jun 29, 2010, 3:31:23 PM6/29/10
to
Steve,
Thanks for your suggestion but if possible I would rather use a VBA
customization to prevent a customized sp from being lost during a version
upgade.

docsis

unread,
Jul 3, 2010, 8:06:00 PM7/3/10
to
Bary!!! Help!!! >=)

Barry Flynn

unread,
Jul 4, 2010, 3:33:05 AM7/4/10
to
> Bary!!! Help!!! >=)
Me?
Don't know that I have much to offer here.

A tiny irelevant point - I don't think your mUpdate statement is a good
idea.
mUpdate is used when you have modified the buffer, and want to update it
back into the array.
Here, you haven't modified the buffer, and (assuming a Sort has taken place)
the kernel has been shuffling the array.
So I don't see mUpdate doing any good - and I think it could possibly do
some harm.
However, that is (a) a bit of a guess on my part, and (b) not very relevant
to your sorting problem anyway.

I agree with Steve that modifying the Order-By clauses in the stored
procedure(s) is probably the easiest way.
However, I am very reluctant to modify standard Solomon stored procedures.
And I agree with you that the modified procedures will revert to the
standard versions when you perform any sort of upgrade.

I don't think I have used mKey or mSort in a customization, so I've no
experience to draw on there.
I have used mKeyOffset and mKeyFind, but there was no Grid involved, and I
think they are a bit of a different subject anyway.

I did wonder whether the grid had been loaded at the point when your code
runs.
But I think it has.

I note that your grid handle for most of your code is MemHandle.
But the mDisplay uses OrigGridHande.
That doesn't look right.
Is that just a typo in the code you posted?
If its not a typo, then you are possibly not succeeding in displaying the
modified grid.

I note that Help for mKey says that you must previously have executed a
vba_SetAddr.
In your case, you won't have your "own copy" of bARDoc1, so the SetAddr will
be the one that has been executed by the host screen. I assume that is OK...

Just a few ramblings that probably aren't much use, I'm afraid.

Barry

--

Barry Flynn
Complete Solutions DG


"docsis" <doc...@discussions.microsoft.com> wrote in message
news:D3FDA034-B3EB-4EC2...@microsoft.com...

docsis

unread,
Jul 5, 2010, 10:43:12 AM7/5/10
to
yes the original code was a typo and I removed the Mupdate. Still unable to
sort in the user field. This may just be something Solomon doesnt allow to be
customized.
"Barry Flynn" wrote:

> .
>

0 new messages