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) }
}
|