Thanks Olaf,
I am sorry it appears that I am posting the same question in different ways, you and Borislav helped me with 2 other questions which was a big help, but although I am still working with the same data this is a different issue.
The basic problem is that I have to reverse the sign of the data in one of the tables, this is irrelevant of the second table where the data is going to be merged, but I may be wrong. I'll try to give you a brief idea of the bigger picture.
We sell lighting fixtures and I am trying to collect data of all the components taken out of inventory on a monthly basis, the components go out of inventory in 2 ways ....
A direct sale of let's say 100 lighting fixtures of stockcode 1234, this goes out as a positive number and stored in one table ... +100, sometimes the sale gets cancelled and the items go back into stock as a negative -100
We also use components in lighting "kits" those go out of inventory as a negative quantity and go into another table, let's say -100 pcs of XYZ, sometimes the kit gets "reversed" and put back into inventory as a positive number.
I know the above does not make a lot of sense in the real world, but the application we use at work is strange and we are not going to change it anytime soon.
I end up with 2 tables that look like this:
sales:
stockcode jan feb
1234 100 -50
4567 50
kits:
xyz -100 +50
4567 - 50
In the end I have to do a report of all components "sold" I need the data to be all in positive if it went out of inventory and negative if it came back in. That is why the jan field of the kit table has to be reversed to +100 and +50. If I add 4567 from both tables I would end up with 0 when in reality I need to show +100.
I hope I did not make this too confusing and I am sorry if I am missing something.
Right now I use a formula such as:
DO CASE
CASE jan < 0
REPLACE jan WITH ABS(jan)
CASE jan > 0
REPLACE jan WITH (jan-(jan*2))
ENDCASE
This works, but I have suspicion that it can be done much simpler without writing so much code.
Thanks again,