Normal Topic @xResultSetSearch question. (Read 2205 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
@xResultSetSearch question.
Apr 22nd, 2019 at 6:33pm
Print Post Print Post  
I am selecting a bunch of data from one of my data bases in order to review the Sales History of our products using @xResultSetSearch.  The statement is in the program below.  The list created (vHandle) is then sorted by the PartNo variable, which may have several variations (for example, 1000AA, 1000AA3, 1000AB, etc)

I then display the last 100 data points in vHandle. 

This is working OK but I want to sort by the date variable DATE1 in the Sales file.  I've tried to limit how old the data can be by modifying the statement thus:

     vHandle=@xResultSetSearch(@FN,"Sales", SEARCH_MODE_AND,SEARCH_SYNTAX_QA, "!PartNo="+vDCNo+"..","!DATE1>@Date-1095")

Unfortunately, this doesn't work. 

Do you have any suggestions on how I can limit the information selected to files that were shipped in the last 3 years?

Thanks for your help!


// View Shipment History


If @mode() = 1

{

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

     XResultSetSort(vHandle,"Partno:-1;date1:-1")

     vLoop=vA

     
     If(vHandle>-1)
     {
     
           vNoOfRecords = @XResultSetTotal(vHandle)

           If vNoOfRecords>100 then vA=vNoOfRecords-100
     
           For vLoop= vA to vNoOfRecords
     
                 xResultSetCurrentPosition(vHandle,vLoop)
     
                 vPartNo = @xResultSetValue(vHandle,"PartNo")
                 vName = @xResultSetValue(vHandle,"Diaphragms")
                 vStatus = @xResultSetValue(vHandle,"Date1")
                 v2 = @right(vStatus,2)
                 v3 = @mid(vStatus,3,2)
                 v1 = @mid(vStatus,6,2)
                 vStatus = v1 + "/" + v2 + "/" + v3
                 vQuantity = @AsFormattedByLE(Junk4,0,(@xResultSetValue(vHandle,"PCS")))   


           // create the variable
                 
                 vLine=vline + vPartNo + "  Date: " + vStatus + " -- Quantity: " + vQuantity+ @Newline()
     
                 vTemp1=1
                 Next
     
                 xResultSetClose(vHandle)
     }
     
     
     if vTemp1<1
     {
           Writeln("NO PARTS ARE ON ORDER.")
     }
     else
     {
           vStr=@SortStringArray(vLine,0)
           Writeln(vStr)
     }

}

  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: @xResultSetSearch question.
Reply #1 - Apr 22nd, 2019 at 6:38pm
Print Post Print Post  
Hi Paul,

You're missing an equal sign in there. The syntax for the search parameters is always !FieldName=YourSearchSyntax.

And...

You want @Date-1095 outside of the quotes as you want the calculated value not the literal string of "@Date-1095"

Code
Select All
     vHandle=@xResultSetSearch(@FN,"Sales", SEARCH_MODE_AND,SEARCH_SYNTAX_QA, "!PartNo="+vDCNo+"..","!DATE1=>" + (@Date-1095)) 



-Ray
  

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