I have a seemingly simple problem but I think due to lack of sleep I am missing the obvious.
I have a table that contains Vendors, invoices and invoice amounts and I am trying to write a query to solve a problem with duplicate payments. To search for duplicates, I am needing to query the table and return only records where the Invoices #'s are different with the same transaction $ amount for the same vendor.
For example in the list below, the $10 and $25 dollar transactions would be included on the query results.
TABLE FILE ???
SUM COMPUTE TOTDOLLAR/P20.2M = DOLLARAMT ;
BY VENDOR
PRINT DOLLARAMT
COMPUTE FILTER/A1 = IF TOTDOLLAR NE DOLLARAMT THEN 'Y' ELSE 'N' ;
BY VENDOR
BY INVOICE
WHERE TOTAL FILTER EQ 'Y'
END
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
February 25, 2011, 09:06 AM
PBrightwell
Try this: -* SORT the file by vendor and amount TABLE FILE INVOICEFL PRINT INVOICE_NO BY VENDOR_NO BY AMOUNT ON TABLE HOLD AS MYFILE END -* PRINT THE DUPS DEFINE FILE MYFILE LST_INV/A10=IF VENDOR_NO EQ LAST VENDOR_NO AND AMOUNT EQ LAST AMOUNT THEN LAST INVOICE_NO ELSE ''; END TABLE FILE MYFILE PRINT INVOICE_NO LST_INV BY VENDOR_NO BY AMOUNT WHERE VENDOR_NO EQ LAST VENDOR_NO AND AMOUNT EQ LAST AMOUNT AND INVOICE_NO NE LAST INVOICE_NO ON TABLE PCHOLD END
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
February 25, 2011, 09:52 AM
jgelona
This will return the rows where the vendors are the same, the amounts are the same and the invoice numbers are different. Rows where all 3 fields are the same are not returned:
TABLE FILE FPDATA
COUNT INVOICE NOPRINT
BY VENDOR
BY DOLLARAMT
SUM MAX.INVOICE NOPRINT
BY VENDOR
BY DOLLARAMT
BY INVOICE
WHERE TOTAL CNT.INVOICE GT 1
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD
END
-*
TABLE FILE HOLD
COUNT INVOICE
BY VENDOR
BY DOLLARAMT
SUM MAX.INVOICE NOPRINT
BY VENDOR
BY DOLLARAMT
BY INVOICE
WHERE TOTAL CNT.INVOICE GT 1 ;
END
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
February 25, 2011, 07:37 PM
Bethanne
TABLE FILE ????? SUM CNT.INVOICE NOPRINT BY VENDOR NOPRINT BY TRANSACTION_AMOUNT NOPRINT PRINT VENDOR INVOICE TRANSACTION_AMOUNT BY VENDOR NOPRINT BY TRANSACTION_AMOUNT NOPRINT WHERE TOTAL CNT.INVOICE GT 1; END
February 26, 2011, 05:55 AM
FrankDutch
lots of solutions the solution of WAZ holds a little mistake, but is in the basic very simple...
BY INVOICE should be imho BY DOLLARAMT
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
March 02, 2011, 05:23 PM
kadkins
Thanks to all who responded. I used a combo of some of the suggestions to get to the data I needed. Thanks!