Normal Topic @SpecCommand for sort (Read 434 times)
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
@SpecCommand for sort
Mar 15th, 2011 at 3:58pm
Print Post Print Post  
How do I use @SpecCommand to set and run a sort not using a saved sort spec?

Basically, in a subform I have a list of documents.  When a new document is added, Doc_No is set 1 higher than the previous number, Date_Added is set to current date, document text is stored in Doc_Text and there is a Description.  The list displays in Table view showing the Doc_No, Date_Added and Description fields.  Currently, they display in ascending order.  I want to be able to display either lowest-to-highest Doc_No (oldest first) or highest-to-lowest Doc_No. Doc_No is a number, not text.

I use (SPEC_OPERATION_SET, SPEC_TYPE_SORT, "Doc_No=A") and

(SPEC_OPERATION_RUN, SPEC_TYPE_SORT, "")

These don't generate syntax errors but they also don't update the display, even if followed by ForceRedraw().

Based on page 395 for Retrieve, it looks like I should be able to create a spec on the fly.  (Since most sorts I want to create for other parts of the application also will involve just 1 field, I would rather do them on the fly than create and save a bunch of sort specs.)

  
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: @SpecCommand for sort
Reply #1 - Mar 15th, 2011 at 5:26pm
Print Post Print Post  
Hello Rick,

Try:

Code
Select All
Var vReturn as String

vReturn = @SpecCommand(SPEC_OPERATION_SET, SPEC_TYPE_SORT, "Doc_No=-1")
vReturn = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_SORT, "")  



-Ray
  

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