Normal Topic Modifiable date spec with quick report question? (Read 563 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Modifiable date spec with quick report question?
Sep 10th, 2014 at 4:32pm
Print Post Print Post  
Is there a proper technique of some sort to have the calendar or just a way to pass a specific date to an existing quick report spec?  Basically all the other retrieve information in the spec are always the same but there are times a user wants to run the report for yesterday or a specific date instead of today. 

Somewhere I thought I remember seeing something on this but no matter how I search I am not finding it.

presently I am using the code below. My thought if there is not some magical Lantica / Hammer Data / Sesame Forum recommended technique is to build the entire retrieve spec in sbasic with the calendar popup for the user to select and then run the saved sort spec,  and   RunQuickReportSpec.

Thoughts on doing this?

Thanks


var VStr as string
var vRun as int

     // Loads an already saved retrieve spec for use
     vStr = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_RETRIEVE, "DailyPosting")
     
     // Runs the currently loaded retrieve spec
     vStr = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_RETRIEVE, "")
     
     // Loads an already saved sort spec for use
     vStr = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_SORT, "DailyPosting")
     
     // Runs the currently loaded sort spec
     vStr = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_SORT, "")
     
     if(@Mode() = 1)
     {
           vRun = @LoadQuickReportSpec("DailyPosting")
           if(vRun = 1)
           {
                 RunQuickReportSpec(REPORT_MODE_HTML_PREVIEW, PRINT_ORIENTATION_LANDSCAPE)

                 // Clears the current retrieve spec
                 vStr = @SpecCommand(SPEC_OPERATION_CLEAR, SPEC_TYPE_RETRIEVE, "")
           }
     }

  

Team – Together Everyone Achieves More
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: Modifiable date spec with quick report question?
Reply #1 - Sep 11th, 2014 at 1:23pm
Print Post Print Post  
Hello Robert,

Something like this should work for you.

Code
Select All
#Include "Sbasic_Include.sbas"

Var vDate as Date
var VStr as string
var vRun as int

     // Loads an already saved retrieve spec for use
     vStr = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_RETRIEVE, "DailyPosting")
     vDate = @Calendar(@ServerDate(), "Pick a Posting Date")
     If Not @Error Then
     {
          PostingDate = vDate
     }
     // Runs the currently loaded retrieve spec
     vStr = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_RETRIEVE, "")

     // Loads an already saved sort spec for use
     vStr = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_SORT, "DailyPosting")

     // Runs the currently loaded sort spec
     vStr = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_SORT, "")

     if(@Mode() = 1)
     {
           vRun = @LoadQuickReportSpec("DailyPosting")
           if(vRun = 1)
           {
                 RunQuickReportSpec(REPORT_MODE_HTML_PREVIEW, PRINT_ORIENTATION_LANDSCAPE)

                 // Clears the current retrieve spec
                 vStr = @SpecCommand(SPEC_OPERATION_CLEAR, SPEC_TYPE_RETRIEVE, "")
           }
     }

 



-Ray
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Modifiable date spec with quick report question?
Reply #2 - Sep 11th, 2014 at 3:37pm
Print Post Print Post  
Ray as always you are the BEST!

This is such a nice and elegant solution that works like a charm. I can see so many ways to use this technique and with very minor tweaking can easily see using it to create ranges with start dates and end dates.

This is the perfect building block type of Sbasic code that is ideal to add to my  toolbox of code you have given me over the years.

Thanks for taking your time to do this for me, once again this is proof that Hammer Data / Lantica  has the best people and surely the best customer service (actually customer care!) of any company around.

your effort is really appreciated, Thanks Again!
  

Team – Together Everyone Achieves More
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: Modifiable date spec with quick report question?
Reply #3 - Sep 11th, 2014 at 8:24pm
Print Post Print Post  
You are most welcome Robert.

One thing to keep in mind is that if you want to create a date range you will need to use FormFieldValue() to force the date range into the element as just setting it like DateLE = vDateRange will result in only 1 date being in the DateLE. This is because SBasic knows that DateLE is a Date element and therefore can only store a Date, but since we're at the retrieve spec and the element can hold anything, You can just sneak around the internal type conversion by using FormFieldValue().

-Ray
  

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