Muffntuf and LB thanks for your help. Although the revised formula checks okay it is not quite doing what I need it to do. After looking at this even closer now I think I should have given you an example of what I was trying to accomplish. Very sorry if I wasted your time in not doing so.
This is our setup, we have an accounting system and WMS. What items are in the accounting system should be in the WMS logically but it is possible that one item is in one but not the other but never an item would not be in both, it just can't happen. My main table that I drive off of is determined by either of the two master item tables,
accounting or
wms. Master_item being my drive key and book_item being that of accounting and phy_item of the WMS.
[tt]
master_item
book_item phy_item
00125 null 00125
00201 00201 00201
00276 00276 null
[/tt]
So therefor an item would have to be in at least one of the two systems. So this part of the formula can be eleminated
Code:
if isnull({VIEW_GP_OnHand.QTYONHND}) and
isnull({VIEW_Phy_count_NEW.phy_Total_Pcs}) then
0
because it just can never happen. That's why I did not compensate for it originally. But because of my lack of an example you did not realize it, sorry.
Keep in mind now that this is for a variance on a physical inventory count.
{VIEW_Phy_count_NEW.phy_Total_Pcs} is the physical inventory count,
{VIEW_GP_OnHand.QTYONHND} is the book count. Therefore if the phy count is less than the book the variance should be a negative, if the book count is higher than the physical count then the variance should be a plus.
Here are my desired results:
[tt]
Item
Book Phy Var
00125 Null 100 100
00201 100 50 - 50
00276 200 Null -200
---- ---- ----
300 150 -150
[/tt]
Now I believe my original formula did this
for book:
Code:
#1
if isnull({VIEW_GP_OnHand.QTYONHND}) then {VIEW_Phy_count_NEW.phy_Total_Pcs}
else {VIEW_Phy_count_NEW.phy_Total_Pcs} - {VIEW_GP_OnHand.QTYONHND}
for phy:
Code:
#2
if isnull({VIEW_Phy_count_NEW.phy_Total_Pcs}) then {VIEW_GP_OnHand.QTYONHND}
else {VIEW_GP_OnHand.QTYONHND} - {VIEW_Phy_count_NEW.phy_Total_Pcs}
My problem is not being able to combine them to work together.
Again sorry for the lack of an explanation and again thank you for your time.