Normal Topic Learning to use XResultSet 101 - Help? (Read 331 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Learning to use XResultSet 101 - Help?
Mar 18th, 2012 at 1:04am
Print Post Print Post  
Hi all,

So I’m attempting to learn how to use the XResultSet commands.  I need to do so for automating our client statement functions.

I’m trying to build a command button on our Client CRM screen that creates a merge doc file, pulling information from our Client, Staff, and Payment database.

I need my command button on the Client screen to go to the Payment database, and compare payments made between two date ranges for that specific client number, and return with a sum.  Because I’m pulling on two commands, I understand I need to use XResultSet.

So I’ve tried building a sample XresultSet command to do the following:

Code
Select All
#include "sbasic_include.sbas"

var vRSHandle as int
var vNoOfRecords as int

vRSHandle = @XResultSetSearch(@FN, "Payments", SEARCH_MODE_AND, SEARCH_SYNTAX_QA,
"!PmtCltNo=3031", !PmtDate >=”Mar 1, 2012”)

vNoOfRecords = @XResultSetTotal(vRSHandle)

WriteLn(vNoOfRecords)
 



I know from looking at the raw data, this should bring back a result of “201” (as I have 201 payments between that date range), however WriteLn is bringing back “-1”.

Am I missing something?
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Learning to use XResultSet 101 - Help?
Reply #1 - Mar 18th, 2012 at 1:13am
Print Post Print Post  
Use the following:
Code
Select All
#include "sbasic_include.sbas"

var vRSHandle as int
var vNoOfRecords as int

vRSHandle = @XResultSetSearch(@FN, "Payments", SEARCH_MODE_AND, SEARCH_SYNTAX_QA,
"!PmtCltNo=3031", "!PmtDate=>" + "2012/03/01")

If vRSHandle > -1 then
{

vNoOfRecords = @XResultSetTotal(vRSHandle)

WriteLn("Number of Records = " + @str (vNoOfRecords))
xResultSetClose (vRSHandle)

}
 



Note the change: "!PmtDate=>" + ”2012/03/01”

Also note that above would not include payment date of 03/01/2012.

Let us know if this works.
  
Back to top
 
IP Logged