Sort List Form by (Dynamic) button

shogan@mila.ieshogan@mila.ie Member Posts: 113
Hi all,

Good morning and hope you are well.

I have created a new list form based on the Sales List form that displays all orders outstanding (i.e. Order Status = backorder, printed, passed to credit control, etc.) I also have it automatically refreshing every 10 seconds (very nifty feature, even if I do say so myself!).

Now what I would like to do is create a button that would change the sort based on a different key, (that already exists).

I know HOW to create a button, and I think the following http://www.mibuso.com/forum/viewtopic.php?f=23&t=11831&hilit=sort+form+list is along the idea of what I want to do, but based on the programming of a button.

So the default sort applied on opening the form is "Document Type, No." and I'd like the button to change it to "Document Type", "Sell-to Customer No., "No.". I just don't know what triggers on the button I need to apply the additional code to. Sounds simple, but again I am a newbie and I just want to make sure I am following best practice.

Any help appreciated.

Thanks in advance.

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Why do you want to do it via Code?
    You can simply click Shift+F8 and select Key and Order..
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    Hi Mohana,

    Request from Financial Director and to be given to Credit Controller.

    What I hope to do it make it dynamic - actually have one button overlay the other - one sort hides the button to change the sort, and the underlaid button restores it.

    I'm looking to toggle between he two sorts; here, the company prefers visual cues. I think it lends itself to clarity.

    And also, explaining keys and sorts to people here generally doesn't work well. It's a "spoon-feeding" exercise, I know. Usually resorting means trying to remember the original key if you want to get back to the original screen etc.


    Trust me, I have plenty of reasons "why" - and for me as a learning exercise.



    Thanks!
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Well, if you want to go ahead with coding then you need to write the code under PnPush trigger of Button..
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    Thanks Mohana.

    I'll give it a shot and see what happens.

    If I run into difficulties, I'll get back on here... but I think I have enough to start with.
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    :D Sorted.

    And a lot easier than I thought.
    SETCURRENTKEY("Document Type","Sell-to Customer No.","No.");
    


    Then another button:
    SETCURRENTKEY("Document Type","No.");
    
    - this key is the default key.


    Even managed to overlap one button on top of the other, and pseudo-toggle it:
    CurrForm.btnSortCustNo.VISIBLE := FALSE;
    

    ... and TRUE; where appropriate!



    Thanks for the heads up!


    Case closed.
Sign In or Register to comment.