Normal Topic Sort Subform Items before Printing (Read 3305 times)
flobo
Member
*
Offline



Posts: 16
Location: Germany
Joined: Feb 20th, 2014
Sort Subform Items before Printing
Mar 6th, 2014 at 7:48am
Print Post Print Post  
Hello everyone,

I used the example from SesameSeasons to develop an Invoice with a subform.

I would like to sort my Items in the table-view subform before they get printed.

I’ve tried a Sort-Spec but this only works in Search/Update mode.

Is there a way to manage that directly in programming?

Sorry for my bad english.
I hope you understand what I mean.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Sort Subform Items before Printing
Reply #1 - Mar 6th, 2014 at 4:44pm
Print Post Print Post  
Your English is perfect. I wouldn't have known that it's not your first language.  Smiley


The way I see it, you have 3 options.

1. Switch to Search/Update mode to print. This will allow a default sort on the subform to control the order of the line-items.

2. Enter the line-items in the order you want them to appear.

3. Inside Sesame has two articles, that I can think of, which detail programming options to help with this. One is an article that I wrote titled "A Better Table View Subform Editor". It includes a subroutine named cuMoveSubrecord(). That subroutine was inspired by another article that Tom Marcellus wrote, titled "Reorder Rows in a Table Subform".

Tom's article appears in the March 2009 issue on page 17.
My article appears in the October 2012 issue on page 5, but the subroutine may be all you really need. It appears on page 12.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Sort Subform Items before Printing
Reply #2 - Mar 6th, 2014 at 5:42pm
Print Post Print Post  
hush, don't tell anyone - but, "extend mode" in search update is basically "add mode" with a few more bells and whistles.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Sort Subform Items before Printing
Reply #3 - Mar 9th, 2014 at 7:04pm
Print Post Print Post  
Ah! Simple solution, Mark -- Just add new records in Extend mode, and the subform can be sorted there.

That one got by me because 99% of the time I disable Extend mode with:
Code
Select All
FormNotifyForm(@Layout + ":(Update)", 7) 



I've been doing that so long that I don't really remember why I started.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
boflo
Member
*
Offline



Posts: 2
Joined: Feb 20th, 2014
Re: Sort Subform Items before Printing
Reply #4 - Mar 11th, 2014 at 6:08am
Print Post Print Post  
Thx for your answers.

I will try to sort in the extend mode.  Smiley
  
Back to top
 
IP Logged
 
flobo
Member
*
Offline



Posts: 16
Location: Germany
Joined: Feb 20th, 2014
Re: Sort Subform Items before Printing
Reply #5 - Mar 11th, 2014 at 11:31am
Print Post Print Post  
I've found another solution.

After the line-items were entered, I just start a XResultSetSearch, sort it with XResultSetSort and get it printed via PrintString.

So it is possible to sort the line items before they get printed.
  
Back to top
 
IP Logged