Alpha DevCon 2018
Results 1 to 16 of 16

Thread: Is there anyway to change the sort order of a report via code when opening it?

  1. #1
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Is there anyway to change the sort order of a report via code when opening it?

    Hi All,
    We have a built a common report that via Power Search we have managed to combine 6 reports into one and the users can filter to their heart's content and get a report that meets there needs. The one sticking point is we can't work out how to dynamicly sort the report. as in we want them to select frpom a drop dropdown and select sort by Age, or Location or what ever other fields we define.
    I can see where you set the sort order in the report/ Detail properties but we want to sort on the fly... by code.

    Any reporting gurus out there that can shed some light on how to do this?


    Thanks in Advance


    Bruce

  2. #2
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,481

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Look at action scripting to Print a Layout and use the xbasic generated from various options.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    "Certified" Alphaholic
    Real Name
    Lee Vasic
    Join Date
    May 2010
    Location
    Salt Lake City
    Posts
    1,072

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Here's a picture of what Al is talking about. Convert your javascript to text. Then you can get at more detail.
    ReportSort.PNG

  4. #4
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Thanks Lee, yes that would work if we were just opening the report normally but we are embedding the report then running the "Run a report that is embedded...." as this allows all the builtin filtering ... but no ording... and you don't get access to the underlying javascript... that we can see.
    So we seem to be a bit stuck

  5. #5
    "Certified" Alphaholic
    Real Name
    Lee Vasic
    Join Date
    May 2010
    Location
    Salt Lake City
    Posts
    1,072

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    You could handle the filtering the same way as the sorting. I'll take a look at the embedding. I've never used that.

  6. #6
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Quote Originally Posted by lvasic View Post
    You could handle the filtering the same way as the sorting. I'll take a look at the embedding. I've never used that.
    Hi Lee here is a walkthrough https://www.screencast.com/t/7lAs46JHba of where we have hit a wall

    Any suggestions would be appreciated.
    Last edited by kiwibruce; 07-10-2018 at 07:24 AM.

  7. #7
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,441

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    It looked to me like you were close. Did you try to put the name of your order drop down control {OrberBySelection} in the expression builder for the local filter / order dialog? If you click on field name button in that dialog it will show a list of available fields.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  8. #8
    "Certified" Alphaholic
    Real Name
    Lee Vasic
    Join Date
    May 2010
    Location
    Salt Lake City
    Posts
    1,072

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    This is the way I do it. Check out the video. (The embed method doesn't seem to give you the options that you need) The method I use in the video looks and acts like the embed but with all the options.
    https://www.screencast.com/t/2yVNQuyuEG

  9. #9
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Quote Originally Posted by lvasic View Post
    This is the way I do it. Check out the video. (The embed method doesn't seem to give you the options that you need) The method I use in the video looks and acts like the embed but with all the options.
    https://www.screencast.com/t/2yVNQuyuEG
    Very nice Lee, nice work, thanks for sharing. Yeah, we may have to go down this route, it's a shame as the Embedded report Action is so useful but is just missing the SortOrder feature.

  10. #10
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Quote Originally Posted by frankbicknell View Post
    It looked to me like you were close. Did you try to put the name of your order drop down control {OrberBySelection} in the expression builder for the local filter / order dialog? If you click on field name button in that dialog it will show a list of available fields.
    The builder dosn't like that.. Unless I am missing something

  11. #11
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,441

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Do you get a list of available fields when you click on the field button?
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  12. #12
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Quote Originally Posted by frankbicknell View Post
    Do you get a list of available fields when you click on the field button?
    fields in the report yes but not fields on the UX

  13. #13
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,441

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    OK can you add that field to the report? I know I did something like this before I just can't find the report for an example. Maybe by creating a variable and setting its value to the order field. I'm sorry I can't help more I am out in the field this week.
    Last edited by frankbicknell; 07-11-2018 at 09:05 AM.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  14. #14
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    390

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Yey! Selwyn has now built exactly what I needed, it will be in tomorrows pre-release https://www.screencast.com/t/bKifF2FDg
    This now makes the Embedded Report search even more powerful

    Thanks For everyone's suggestions, I have learned some cool tricks.

    Thought I would also share this video from Selwyn https://www.screencast.com/t/IIsZJiCS on another way of affecting sorting... and any aspect of the 'ro' object can be modified... when calling reports normally... alas NOT applicable for an embedded report which was my use-case and thus why none of these soloutions worked in my use-case, but good to know. so many things like this in Alpha that is burried in there somewhere.

    Thanks again all, love this community.
    Last edited by kiwibruce; 07-12-2018 at 03:13 AM. Reason: typo

  15. #15
    "Certified" Alphaholic
    Real Name
    Lee Vasic
    Join Date
    May 2010
    Location
    Salt Lake City
    Posts
    1,072

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Very nice. This really opens up many possibilities.

  16. #16
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,460

    Default Re: Is there anyway to change the sort order of a report via code when opening it?

    Really nice feature addition for reports!
    Alpha Anywhere v12.4.5.4.5 Build 5207-5148 IIS v8.5

Similar Threads

  1. User Changing Sort Order of Report
    By programsplus in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 07-20-2008, 12:01 PM
  2. Sort report in a different order
    By kdankwah in forum Alpha Five Version 7
    Replies: 4
    Last Post: 09-21-2007, 03:48 PM
  3. Setting Index, Sort Order on Browse vs Report
    By dik_coleman in forum Alpha Five Version 7
    Replies: 11
    Last Post: 04-01-2006, 05:08 PM
  4. sort order on grouped report
    By John Lemisch in forum Alpha Five Version 4
    Replies: 6
    Last Post: 12-20-2002, 11:08 AM
  5. Report sort order
    By Edward F. Schulz in forum Alpha Five Version 4
    Replies: 6
    Last Post: 11-09-2002, 12:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •