Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) export data unsorted (Read 3245 times)
robwood_ok
Member
*
Offline


No personal text

Posts: 23
Joined: Jan 29th, 2004
export data unsorted
Dec 1st, 2005 at 5:25pm
Print Post Print Post  
I've been doing ascii exports for a while in Sesame, I thought they were sorting as per my retrieve spec, but I must have been just getting lucky.  Now I am getting unsorted export data on records that I sorted after I retreive it, but before I export.

How do I create a sorted exported ascii file?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: export data unsorted
Reply #1 - Dec 1st, 2005 at 6:53pm
Print Post Print Post  
Hello,

Sesame's Exports will sort automatically by the first Text field that is set to be exported. So if you export "Last Name", "First Name", "City" in that order. The records will be sorted by "Last Name". If two Last names are the same then the export will sort by First name within the last names that are the same.

-Ray
  

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


No personal text

Posts: 23
Joined: Jan 29th, 2004
Re: export data unsorted
Reply #2 - Dec 1st, 2005 at 10:32pm
Print Post Print Post  
So if the first field is a Text field, but the second and third fields are numbers, then I am out of luck as far as sorting?   What about a Date field, would that sort on export?

or...Is there a way to just output in result order.  So that if I sort my search results and then export, it just spits them out in the order that it comes to the records?

Thanks for the help!
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: export data unsorted
Reply #3 - Dec 1st, 2005 at 10:55pm
Print Post Print Post  
Export needs to sort in export field order to support the standard format for hierarchial ASCII import/exports (forms with subforms), which requires that the subform records immediately follow the parent records and repeat the parent fields exactly.

I may be wrong, but I believe that all field types sort as though they were string type in ASCII export.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: export data unsorted
Reply #4 - Dec 1st, 2005 at 10:58pm
Print Post Print Post  
Quote:
or...Is there a way to just output in result order.  So that if I sort my search results and then export, it just spits them out in the order that it comes to the records?


You can use a mass update and the SBasic file I/O routines to create a ASCII export in result set order, or you can rearrange the export spec to reflect the results of the sort spec - but that will rearrange the order of the fields as they appear in the file.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: export data unsorted
Reply #5 - Feb 1st, 2006 at 12:12am
Print Post Print Post  
I am having a similar problem and I am wondering if someone can help me out. I have an invoicing application that was created and then old invoices(from Q&A) dating back ~8 years were imported. The invoice layout has a LineItem subform(table view) created using relational linking and the line items were linked to the main invoice form by invoice number. The import of the lineitems went smoothly and everything seemed to work. Until new invoices were added. Once saved and retrieved, the lineitems of the newly added invoices show up on the invoice out of order, as if they are being sorted once saved. An example would be :
LineItem subform has 5 fields in this order, Account#, Description, Quantity, Price and Amount.
When an invoice is entered and saved in this order:

Account #| Description | Qty | Price | Amount |
1                   b                 1        $1          $1
1                   a                               
                    d
                    c

On retrieve the line items change order to this :

Account #| Description | Qty | Price | Amount |
                    d
                    c
1                   a         
1                   b                 1        $1          $1


Excuse the spacing. The line items on the invoices that were imported from Q&A are fine and in order, its just new invoices that are entered and saved that seem to have the line item order mixed up.

I tried exporting the data, deleting the subform, re-created the subform using natural inking and imported the data back in. This seems to have solved the problem of new invoice line items getting moved out of order after saving but now the line items that were imported from Q&A are out of order, as if they have been sorted.
From reading this thread, I understand that sesame's export function automatically sorts the exported data. I took the advice given here and used mass update and SBasic code to export but as far as I can see I can only mass update either the main form or the subform one at a time and therefore I have 2 seperate export files, invoice which has ~12000 records and LineItems which has ~30000 records so I can't use sesame's import function to bring the data back into the form and have the line items match up with the corecct invoices, I think. I may not be approaching the mass update procedure properly. Any help(clarity) would be greatly appreciated.
Thanks.
Don                     
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: export data unsorted
Reply #6 - Feb 1st, 2006 at 3:43am
Print Post Print Post  
Don,

I think the only way you will be able to control the order of the subform records (line-items), is to set a sort spec for the subform. Without a sort order specified, I believe the order of the subform records may shuffle around, and be unpredictable, every time you add or delete subform records.

Did you know that you can set a "Default" sort spec for the subform db, that will work even when that db is displayed as a subform on the parent form? It sounds to me like this is what you are looking for.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
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: export data unsorted
Reply #7 - Feb 1st, 2006 at 5:26am
Print Post Print Post  
NorthGuy's problem should really be a separate thread, has no relation to sort order of exports.  But Carl is right....if the records are in the subform, you can create a default Sort Order.  You can also write a routine to sort the subform items when any item in the sort column is added or modified.  Resort should not be needed if a record is deleted.

(See you at SANE on Saturday, Carl?)
-------------------------------------------------

Re the export sort order.......how about this untested approach? .....
1.  Add a sorting element in the front of the Sesame export as the first data element to be exported.  Make the sort element the same datatype as the one you want to sort on. 
2.  Do a mass update to this new sort element to get the value of the 3rd or 4th, or whatever column you really want to sort on.  After Mass Update, export. and data will be sorted by values in the desired column. 
3.  Now you only need to work around the first column.  There are a number ways you may be able to do that, some will depend on the receiving application.

Some options:
1.  Tell the importing program to ignore the first column.
OR
2.  Run the file thru a text editor and strip off the first column before sending to be imported by receiving program.
OR
3.  Read the file and parse out everything to the left of the first comma (or whatever delimiter you selected).  This could be done in Sesame as part of an Export Button.
OR
4. ........fill in the blanks.... other methods can be considered.
  



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


No personal text

Posts: 23
Joined: Jan 29th, 2004
Re: export data unsorted
Reply #8 - Aug 22nd, 2006 at 7:11pm
Print Post Print Post  
Quote:
Quote:
or...Is there a way to just output in result order.  So that if I sort my search results and then export, it just spits them out in the order that it comes to the records?


You can use a mass update and the SBasic file I/O routines to create a ASCII export in result set order, or you can rearrange the export spec to reflect the results of the sort spec - but that will rearrange the order of the fields as they appear in the file.


Time to revisit this, as even with 1.1.4, I still get unsorted ascii exports.   Field #1 is Text, Fields 2 & 3 are Numbers.  The order of the fields in Sort and Export are the same.

I know what a mass update is, but I do not uderstand why I would need to do that for an output routine.  And how would I use the SBasic I/O routines to create the result set?

Is Sesame's "automatic" sort not working because my two numbers fields are actual numbers and I need to set the field Type to Text, just to make this work?

It is just not user friendly to have to resort to special additonal "programming" commands to do something very basic to a database's operation and output.  (Sorry for my continued frustration with Sesame  Cry  I am still missing Q&A's ease of use and output)
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: export data unsorted
Reply #9 - Aug 22nd, 2006 at 8:36pm
Print Post Print Post  
robwood_ok wrote on Aug 22nd, 2006 at 7:11pm:
Time to revisit this, as even with 1.1.4, I still get unsorted ascii exports.   Field #1 is Text, Fields 2 & 3 are Numbers.  The order of the fields in Sort and Export are the same.


There isn't anything in 1.1.4 that would have changed this behavior. We are, however, looking into it for 2.0.
  

- 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: export data unsorted
Reply #10 - Aug 22nd, 2006 at 8:44pm
Print Post Print Post  
BTW, did you ever actually try Ray's original suggestion that you simply put your export spec in the same order as your Sort Spec? I just tried it and it seems to work fine for text, dates, numbers, etc.
  

- Hammer
The plural of anecdote is not data.
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: export data unsorted
Reply #11 - Aug 23rd, 2006 at 12:24am
Print Post Print Post  
If you need to export and sort in diferent order, eg field order left to right must be last name, first name, birthday, but you want to sort by birthday......

1.  Retrieve all the records that you want to export. 
2.  Then sort the result set by birthday. 
3.  Then do a Mass Update that writes the fields in the result set to a file in the left to right sequence that you want, separating with a semicolon or whatever delimiter you want between each field.  Just loop through all the records starting at result set record 1 until last record is done.

If this is a frequent routine then you could make a macro to do this.

  



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



Posts: 2530
Joined: Nov 22nd, 2002
Re: export data unsorted
Reply #12 - Aug 23rd, 2006 at 1:30am
Print Post Print Post  
Bob,

Robwood_ok already expressed that he believes that that solution is too difficult, because of the programming. He also finds that the solution of placing the fields in the sorting order in the export spec does not work for him, because he believes the numerics are sorting in ASCII order. Both Erika and I tested this in 1.1.4 and found that they sorted in numeric order. I confirmed this in the code. The type is checked, and if numeric, the comparison is mathematical. So I am not sure why he is having a problem. It may be that his numerics are actually string fields containing numeric values.

It may be that the check for type was added in a relatively recent version. I checked the change log and don't see it. But I do vaguely remember Bill Halpern asking about it sometime before 1.1.4, probably 1.1.3. Ray might remember.

In any case, I added a feature to Sesame 2.0 so that it keeps exported records in sort spec order (in "flat" databases), unless you are exporting embedded subrecord fields. It is the possibility of subrecord fields that causes Sesame 1.x.x to resort the records. When importing / exporting ASCII with embedded subrecords the sort order has to be fixed by field order, or the importer in Sesame (or MSAccess, or really any DBMS that supports subrecords) will not be able to "attach" the subrecords.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: export data unsorted
Reply #13 - Aug 23rd, 2006 at 3:26am
Print Post Print Post  
Thanks for adding the single level "flatfile" sort to version 2.0.  Cheesy
  



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



Posts: 2530
Joined: Nov 22nd, 2002
Re: export data unsorted
Reply #14 - Aug 23rd, 2006 at 12:53pm
Print Post Print Post  
Quote:
It may be that the check for type was added in a relatively recent version. I checked the change log and don't see it. But I do vaguely remember Bill Halpern asking about it sometime before 1.1.4, probably 1.1.3. Ray might remember.


Ray does indeed remember, it is very recent, actually only appearing in 1.1.5 and 2.0, which why we can see it testing type here, but robwood_ok does not see it.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print