Of course the tables are linked, I have been using CR for almost 2 years now. This report seemed simpled at first... I'll post some more table info...
[STOCK]
- STM_AUTO_KEY (primary key for the table & left outer join from this field to the two others)
- All other fields contain stock info and arent important for the report
[STOCK_ADJUST]
- SAJ_AUTO_KEY (its own primary key)
- STM_AUTO_KEY
- CHANGE_DATE
- COST_ADJ
- QTY_ADJ
[STOCK_TRANS]
- STT_AUTO_KEY (its own primary key)
- STM_AUTO_KEY
- CHANGE_DATE
- COST_ADJ
- QTY_ADJ
Im filtering all the stocklines that are in either of the "STOCK_XXXX" tables with the COST_ADJ field. So that field must contain an amount in either table, this way I can calculate total cost adjustments of our stock daily, monthly, etc...
I noticed that depending on the adjustment, the same information can be inserted in both the TRANS & ADJUST tables. So I added this filter...
IF {STOCK.STM_AUTO_KEY} = {STOCK_ADJUST.STM_AUTO_KEY}
AND {STOCK.STM_AUTO_KEY} = {STOCK_TRANS.STM_AUTO_KEY}
THEN {STOCK_ADJUST.COST_ADJ} <> {STOCK_TRANS.COST_ADJ}
Find the double entry and if the cost is the same remove one... this didnt work too well but it did filter out about 20,000 stocklines out of 250,000.
Here's some typical data Im getting right now...
STM_KEY SAJ_KEY STT_KEY COST_ADJ
123456 280
162350 168.13
123456 280
162451 168.13
123456 174933
280 168.13
123456 174934
280 168.13
123456 175035
280 168.13
123456 280 280 168.13
This example shows that it looks like the cost adjustments was done 6 times, but it was only done once. When looking in the software, the tables would look like...
ADJUST table & TRANS table
- Adjusted cost 168.13
- Adjusted quantity +3
- Adjusted quantity -1
I just need a filter that will grab the cost_adj field once in either table per transaction. I've tried getting it to compare dates, cost, keys... I always end up getting double entries....