Normal Topic Select multiple items in a file (Read 1038 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Select multiple items in a file
Jan 8th, 2013 at 4:20pm
Print Post Print Post  
I have a file that includes a series of similar part numbers.  For example, 1234AA, 1234AB, 1234AA1, 1234AA3, 1234AC1, etc.  From another file, I want to be able to select all the items of a certain type based on the first six characters. 

Using my list above, I want to select 1234AA, 1234AA1 and 1234AA3.

I then want to place all the information for each of these part numbers into an element of the file.  I'd like the information to be in a list format so it is easy to read.

I know how to select one item that exactly matches one record.  How would I program it to select multiple, similar items?
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Select multiple items in a file
Reply #1 - Jan 8th, 2013 at 4:25pm
Print Post Print Post  
.. is a wildcard.

1234.. will retrieve all the records where the part number begins with 1234.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Select multiple items in a file
Reply #2 - Jan 9th, 2013 at 7:52pm
Print Post Print Post  
I understand what ".." does.  I'm trying to use @xResultSetSearch to create a list that I can enter into a multi-line element in my file.  I've developed the programming below, so far.  I've not used this command much, so I'm a little hazy on the details.

I believe the programming below should create the retrieve spec "1234AA.." and then go to the file Overruns.  It will look for all records where the PartNo is equal to "1234AA..".

When I run the program, it appears to go looking into Overruns because vHandle>-1.  But, it doesn't select any records as vNoOfRecords=0.

Any suggestions would be appreciated!



#include "sbasic_include.sbas"

var vHandle as Int
var VNoOfRecords as Int
var vLoop as Int
var vPartNo as string
var vDCNo as string
var vLocation as string
var vStatus as string
var vDate as string
var vQuantity as int
var vTemp1 as int

vDCNo = @left(DiaCom P\N,6)

writeln(vDCNo)

vHandle=@xResultSetSearch(@FN,"Overrun", SEARCH_MODE_AND,SEARCH_SYNTAX_QA, "!PartNo = "+vDCNo+"..")

WRITELN(VHANDLE)

If(vHandle>-1)

{

writeLN("Made it!")

     vNoOfRecords = @XResultSetTotal(vHandle)

writeln(vNoOfRecords)

     For vLoop= 1 to vNoOfRecords
           xResultSetCurrentPosition(vHandle,vLoop)

           vPartNo = @xResultSetValue(vHandle,"PartNo")

           vTemp1=1
           Next

           xResultSetClose(vHandle)
}

if vTemp1<1
{
     @MSGBOX("IT DIDN'T WORK!","","")
}
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Select multiple items in a file
Reply #3 - Jan 9th, 2013 at 7:59pm
Print Post Print Post  
Try removing the spaces around the equal sign in this section:
"!PartNo = "+vDCNo+".."
  


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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Select multiple items in a file
Reply #4 - Jan 9th, 2013 at 8:07pm
Print Post Print Post  
You're getting partial success because the XResultSet is opening, but it's not finding any matches. The space after the field name is being consider part of the field name. Consequently, Sesame is trying to find a field named "PartNo ", with a space at the end.

It would probably work with a space after the equal sign, but it's just easier to avoid them altogether in this particular parameter.
  


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



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Select multiple items in a file
Reply #5 - Jan 9th, 2013 at 8:47pm
Print Post Print Post  
I just tried it and it works!!  Who'd a thougt a simple space would cause such a problem!!

Thanks!
  
Back to top
 
IP Logged