Normal Topic Report is Breaking on Wrong Column (Read 1015 times)
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Report is Breaking on Wrong Column
Jan 26th, 2012 at 5:42pm
Print Post Print Post  
I have a report that is sorted by date. (Col 1)
then comes location. (Col 2)
The problem arises when there are two locations on the
same day.
I need the locations listed chronologically, alpha sort won't help.

Location        Date           Info
Town A            1/1/2012
Town A            1/2/2012
Town A            1/3/2012

Town B             1/2/2012
Town B             1/3/2012      (what I need)

(I am getting)
TownA              1/1/2012
TownA              1/2/2012
TownB              1/2/2012

TownA               1/3/2012
Town B              1/3/2012
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Report is Breaking on Wrong Column
Reply #1 - Jan 26th, 2012 at 6:27pm
Print Post Print Post  
Hello,

To get the data displayed as

Quote:
Location        Date           Info
Town A            1/1/2012
Town A            1/2/2012
Town A            1/3/2012

Town B             1/2/2012
Town B             1/3/2012


You will want to sort by Location first and then by Date second.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Re: Report is Breaking on Wrong Column
Reply #2 - Jan 26th, 2012 at 6:46pm
Print Post Print Post  
Sorry, I didn't make the problem clear.
Towns are (eg)
New York        Jan 1
New york        Jan 2

Albany            Jan 2
Albany            Jan 3

Scotland          Jan 4     etc.

If I sort the town I get them in alpha order, instead of
chronological.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Report is Breaking on Wrong Column
Reply #3 - Jan 26th, 2012 at 11:00pm
Print Post Print Post  
If you have the following items, how to you want to see the output?

New York        Jan 1
New York        Jan 2
New York        Jan 3
New York        Jan 4
Albany            Jan 2
Albany            Jan 3
Scotland          Jan 4
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Report is Breaking on Wrong Column
Reply #4 - Jan 30th, 2012 at 10:15pm
Print Post Print Post  
Any information on your desired result using my sample data, Stew?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Re: Report is Breaking on Wrong Column
Reply #5 - Feb 20th, 2012 at 1:23am
Print Post Print Post  
Have been off fighting other dragons.

Output requested is

Toronto   Feb 1 2012     $345.00
Toronto   Feb 2 2012     $445.00
Toronto   Feb 3 2012     $546.00
Toronto   Feb 4 2012     $221.00

                                  $1557.00

Albany     Feb 2 2012     $150.00
Albany     Feb 3 2012     $200.00

                                    $350.00

Detroit    Feb 3 2012      $125.00
Detroit    Feb 4 2012      $175.00

                                    $300.00

                                  $2,207.00
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Report is Breaking on Wrong Column
Reply #6 - Feb 20th, 2012 at 2:06pm
Print Post Print Post  
OK, I see what you're after. I've built reports like this, but it can't be done simply by sorting. You are looking to find the lowest date, then pick out all the records for the city matching that date, then move on to the record with the next lowest date that has not already been picked out. That's much more complicated than an ascending value sort. You can do this with the XResultSet commands, but it will involve building the report entirely in SBasic and emitting the final result. 

What is the purpose of having the records presented in this way? Perhaps the requirement can be solved in a less code-intensive way.

If not, this is doable, but you'll need to roll up your coding sleeves.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Re: Report is Breaking on Wrong Column
Reply #7 - Feb 20th, 2012 at 10:31pm
Print Post Print Post  
I will see if I can imbed some sort of unique identifier for each location.
Then use that as an invisible columb to build the report.

Thank you, I was embarrased that I couldn't get it.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Report is Breaking on Wrong Column
Reply #8 - Mar 2nd, 2012 at 7:53pm
Print Post Print Post  
Make a hidden field for temp sort sequence number.

Take original list of locations and dates, sort by date, remove lines with duplicate locations. 

Now, assign an incrementing number to each line in order to use as a temp sort value. 

Now mass update the original list, assigning the same number to all the duplicate locations in the temp sort sequence field. 

Now you can do a final sort by tempsort sequence number, and date. Run your reports.

When done, clear out the temp sort field for future use.
« Last Edit: Mar 2nd, 2012 at 10:13pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged