Alpha Video Training
Results 1 to 17 of 17

Thread: sort order in Report

  1. #1
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default sort order in Report

    In my form I run a saved query with the sort order I want.
    In my Report it does not sort the same as my form.
    In my report under the option "Select Records" I have the "Base report on currently selected records"
    I have 2 group breaks, it does not sort in the detail area. It sorts by a different field ,
    In the pic is shows the fields, it is suppose to sort by the "weight" field then by the "New Item" field.
    the sort order is correct in the form/browse,
    to see how this is grouped, it is on the 1st 2 letters of the"New Item" field.

    in the next pic is the report. the red arrow on the left side point to a record that shows "1/2 oz", it is the smallest and should be at the beginning of this group, it is that way in the form/browse, but not in the report.
    the sort is based on the numeric field called "weight" in my report is displays the fraction as a char.

    I have went through all of the Properties in the report and here is a screenshot of the detail properties and the 2 group properties "Style" and "Size"
    when I use the "Size" group, it sorts like it should, but the Detail never sorts by the weight, always the "New Item" field.
    this has bugged me for years and I decided I would try to get it to work but it seems so simple but I can't get it to work.
    Attached Images Attached Images
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  2. #2
    Member
    Real Name
    Jon P Moody
    Join Date
    Nov 2016
    Posts
    185

    Default Re: sort order in Report

    David,

    From what I can tell from your screenshots, 'size' is a character field, so is sorted alphabetically. Sort the group by weight and all should be OK.

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: sort order in Report

    I am somewhat confused if the table shot is showing the records to be selected for the report, because the report does not show Banana Jig (BA) which ought to be next after Bullet Nose (B1) and not Buzz Bait (BZ).

    Also the coding you are using for the new_item field seems inconsistent for ordering the groups, unless you actually have a field named STYLE in this table that you are grouping this report by. The table view sort using Style (BB) + Size (1/16) is also using record number for the new_item ordering and is why it appears correct in your table but is actually not for the report. This is why the 1/2 size is not in the correct order on the report because it's record number is in a different sequence within the BB group. You might want to create an index so you can test it on the table when viewing the default browse.

    "Currently selected records" indicates there is a query/ filter in place, what does that filter look like? You might need a subreport in the detail section...
    Last edited by MoGrace; 07-14-2019 at 12:25 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  4. #4
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    sorry for the confusion, here is a new pic showing a more clear picture of what is going on.
    I didn't go into detail about the actual grouping because I didn't think it would matter. It is just another field with the group. in general it is based off the 1st and 2nd letters of the "New Item" field.
    the grouping works fine and it sorts in the right order.
    In the pic it shows outlined in red the browse and the report of a sample of the data that it not sorting correctly. and the sort it on the "weight" field and it is a numeric. the "weight" field does not display in the report
    Attached Images Attached Images
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  5. #5
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Just to throw in another idea, I think this has more to do with the group breaks than anything else.
    As the data is hopefully sample data, perhaps sharing as small portion of the table and report definition
    will give us a better chance of finding a solution.

  6. #6
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    here is a zip file.
    when it opens click on the only button, then when the form opens click the query, then click the print preview. It shows the Report name "1Report" so it will be on top of the lists of reports.
    Attached Files Attached Files
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  7. #7
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Hi David,

    It took me a bit to get a query that resembled what you showed.
    I finally settled on left(style,2)="bu" to get the results shown in the attached pic.Capture.PNG.

    From what I can tell, it is now sorting by style, weight, and new_item.

  8. #8
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    in your pic it is the same as mine, it is not sorting. the very bottom record is a 1/2 oz and it should be at the top of that group. and I put the numeric field in the report so you could see that it is not sorting.
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  9. #9
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Hey David,

    Don't you hate when computers do what you instruct them to do, rather than what you want them to do.
    The report is sorted by style, then weight, then new_item.
    I'm guessing you really want it sorted by style, then size, then new_item.

    The problem with sorting by size is you have defined size as a character value rather than numeric value, and
    computer sort character values different than they sort numeric values.

    I went through the table and changed the size for the items shown in the attached image to be decimal-based numeric.
    I changed the report to show the size value rather than weight.
    I set the report to sort by style, then size, then new_item.



    2019-07-15_11-07-59.png

  10. #10
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    Quote Originally Posted by madtowng View Post
    Hey David,

    The problem with sorting by size is you have defined size as a character value rather than numeric value, and
    computer sort character values different than they sort numeric values.

    2019-07-15_11-07-59.png
    I guess you mis-read what I said, the "Weight" field is what I am sorting by, NOT the "Size" field. the "Size" field is Character and the Weight field is numeric
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  11. #11
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    Quote Originally Posted by madtowng View Post
    Hey David,

    Don't you hate when computers do what you instruct them to do, rather than what you want them to do.
    The report is sorted by style, then weight, then new_item.
    I'm guessing you really want it sorted by style, then size, then new_item.

    The problem with sorting by size is you have defined size as a character value rather than numeric value, and
    computer sort character values different than they sort numeric values.

    I went through the table and changed the size for the items shown in the attached image to be decimal-based numeric.
    I changed the report to show the size value rather than weight.
    I set the report to sort by style, then size, then new_item.



    2019-07-15_11-07-59.png
    I went back and re-read this and I think I misunderstood what you said. Yes I agree
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  12. #12
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Ok David...now you have me confused.
    What sort order are you really trying to get ?

  13. #13
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    Sorry,
    I want to sort by the numeric "weight" field. that has never changed.
    and that is the field that is selected in the query.
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  14. #14
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    I'm sorry for the confusion but I have never said I wanted it sorted by the "Size" field.

    In the browse it is sorted correct, but when I run the report it is not.


    This is a new development:
    If you would download my sample db again and edit the 1Report and delete the "Size" GROUP, save it and run the report again and the sample file on a different computer of mine finally worked, in the pic the numbers in Red are sorted correct.
    Let me know if it works for you.
    This is the sample file that I opened on a different computer.

    Now, I opened my regular file on different computer, deleted the "Size" GROUP and it sorts correct.

    I delete the "Size" GROUP in my regular computer and IT DOES NOT SORT CORRECT.
    And you think your confused.
    so no wonder after trying 50 different ways it was never going to work on my regular computer.

    so now it works like i thought it should on a different computer but not my regular computer.
    Both have Win7 64 bit

    So in my mind there is some tmp file laying around that needs to be deleted.

    I did restore my regular file in a different folder location and it still does not work.
    I guess I will backup everything, uninstall and delete all files left over and re-install.
    that should work shouldn't it?
    Attached Images Attached Images
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

  15. #15
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Let's try this one.
    I deleted the size group break.2019-07-15_14-28-23.png

  16. #16
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,393

    Default Re: sort order in Report

    Sorry about the confusion David. I got sidetracked when you used the 1/2 size reference to explain what was wrong.
    Looks like we both got to the solution of deleting the size group break.
    About the only thing I can think of that would explain why it won't work on your normal computer
    would have something to do with the query itself. I am working with a very basic query (left(style,2)) just because
    I'm not familiar with all of your data, but it certainly seems to be working as expected.

  17. #17
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Re: sort order in Report

    I appreciate your help.

    Now it works as expected, works on my regular computer, no re-install, I re-inserted the group by Weight field and it work and sorts like I thought it should.
    whey wouldn't it work last week?
    In the pic it shows grouped by weight, but it displays the character size field in a fraction. that is what the size field was for.
    this is what I was trying to do all along,
    Attached Images Attached Images
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

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, 01:01 PM
  2. Sort report in a different order
    By kdankwah in forum Alpha Five Version 7
    Replies: 4
    Last Post: 09-21-2007, 04: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, 06:08 PM
  4. sort order on grouped report
    By John Lemisch in forum Alpha Five Version 4
    Replies: 6
    Last Post: 12-20-2002, 12:08 PM
  5. Report sort order
    By Edward F. Schulz in forum Alpha Five Version 4
    Replies: 6
    Last Post: 11-09-2002, 01: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
  •