Normal Topic S basic command SEARCH_MODE_AND Problem (Read 998 times)
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
S basic command SEARCH_MODE_AND Problem
Sep 30th, 2012 at 1:05am
Print Post Print Post  

I am trying to use the @XResultSetSearch but continue
to get an "unknown identifier" error which I can not overcome.

The error is on the M in SEARCH_MODE_AND

Earlier this year I had used the Sbasic
PRINT_REPORT options which worked perfectly.
After attempting to go to Client/Server the Print_Report
would not work and I went back to the numbers.

I thought my sbasic file may be corrupted

Any thoughts?
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: S basic command SEARCH_MODE_AND Problem
Reply #1 - Sep 30th, 2012 at 1:25am
Print Post Print Post  
Stew Bell,

I do not think you have a corrupted Sbasic file. I am not even sure I have heard of that problem in all the years I have been following Sesame, so if that condition exists its not very common.

If you post your problem Sbasic code and a bit of a description of what you are doing I am sure someone can help.

Just grasping for straws here I was wondering :

Do you have an sbasic_include.sbas file of some kind and is it in the correct place?
Does your code make use of #include "sbasic_include.sbas"

  

Team – Together Everyone Achieves More
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: S basic command SEARCH_MODE_AND Problem
Reply #2 - Sep 30th, 2012 at 3:58am
Print Post Print Post  
I think Bob is right. Just place following in the Global Code of that form and you should not get that error

#include "sbasic_include.sbas"
  
Back to top
 
IP Logged
 
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Re: S basic command SEARCH_MODE_AND Problem
Reply #3 - Oct 1st, 2012 at 4:07am
Print Post Print Post  
This is the code I have so far.

#include "include_sbasic.sbas"  is also in Global Code

#include "sbasic_include.sbas"

     var vRSHandle as int
     var vNoofRecords as int
     var vloop as int

     //vRSHandle = @XResultSetSearch("Data\Expenses.db","Expenses by Cash & Check", SEARCH_MODE_AND ,
     //                        SEARCH_SYNTAX_QA,"!LE2 = Code","!Choose Acct = Accounting.." ,
           //                        "!dollars", "!Pay to")

     //if (vRSHandle > -1)

I haven't gone any further because I can't get past the error.

Thanks for your interest.
  
Back to top
 
IP Logged
 
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
Re: S basic command SEARCH_MODE_AND Problem
Reply #4 - Oct 1st, 2012 at 4:08am
Print Post Print Post  
I wrote the include code wrong.
It is #include "sbasic_include.sbas"
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: S basic command SEARCH_MODE_AND Problem
Reply #5 - Oct 1st, 2012 at 11:56am
Print Post Print Post  
For starters, you don't need to call #include "sbasic_include.sbas" twice. Global Code is the best place for it.

Next, open the sbasic_include.sbas file and verify that you have the following lines in it:
Code
Select All
#define	SEARCH_MODE_AND			0
#define	SEARCH_MODE_OR			1
#define	SEARCH_SYNTAX_QA		2
#define	SEARCH_SYNTAX_REGEX		3 



Also, check the properties of the shortcuts that you use to launch Sesame and SDesigner. Look at the "Start in:" value. It should be "C:\Sesame2" by default. That's the folder where the sbas file should be located.

The error message you are getting indicates that Sesame is not finding the "#define..." lines above. If all else fails you can put those lines in your Global Code, or just enter the numbers directly into the command like this:
vRSHandle = @XResultSetSearch("Data\Expenses.db","Expenses by Cash & Check", 0 ,
                             2,"!LE2 = Code","!Choose Acct = Accounting.." ,
                                   "!dollars", "!Pay to")
  


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



Posts: 21
Joined: Dec 17th, 2011
Re: S basic command SEARCH_MODE_AND Problem
Reply #6 - Oct 2nd, 2012 at 6:59pm
Print Post Print Post  
Thanks,  the sbasic file was in the right place, the "start in" was C:\sesame2 and the lines were in the sbasic file in C:\Sesame2.   Still don't understand the problem, but the solution of using the numbers worked.

Having gotten past that, I am now in a quandry.   


              var vRSHandle as int
     var vNoofRecords as int
     var vloop as int
     var vAcct as string
     var vNet as Money

     vAcct = @Left(ThisElement, 11)
     vRSHandle = @XResultSetSearch("Data\Expenses.db","Expenses by Cash & Check", 0 ,
                             2,"!LE2 = Code","!Choose Acct = Accounting Legal 8000")



     if (vRSHandle > -1)

     {
           vNoofRecords = @XResultSetTotal(vRSHandle)
           for vLoop = 1 to vNoofRecords
                 XResultSetCurrentPosition(vRSHandle, vLoop)
                 vNet =@XResultSetValue(vRSHandle,"Net")
           
     Accounting Legal = (@ToMoney(@SumListValues(vNet)))
     XResultSetClose(vRSHandle)
     next
     }

I have had trouble with the ampersand in the past.  Is there a way to rename a db?

This code will bring back -1 as the handle but I can't get any data.  The code element is "1/1/" + year + ".." + "12/31" + year

Stew Bell
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: S basic command SEARCH_MODE_AND Problem
Reply #7 - Oct 2nd, 2012 at 8:32pm
Print Post Print Post  
The -1 means that it failed to open the XResultSet.

Yes, you can change the database name from within SDesigner.
1. Go to Manage A Database/[DB Name]/Manage Field.
2. Select "Rename Database" from the Action drop-down menu.
3. Type the new name in the New Name box.
4. Click on Add Transaction To Batch.
5. Click on Run Batch.
6. Click on Close.
7. Remember to adjust all of your code.
8. Reconcile.


  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged