Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
brooksc57
Creator
Creator

Subtraction producing odd result

Hello, I am trying to determine why my subtraction is not working.

I've tried applymap and join and both achieve odd result.

I've tried num(field,format) and money(field,format) to the same odd result.

image is return/result. sending it to excel the numbers do appear as numbers and of course subtract to zero...had to put Num() to do so but would have only had to do it on the esc field if that is a hint as to the problem?.

I have tested the sources and their is a unique record in each set so it isn't a one to many issue either.

To further it if I subract the two in an expression...for this example I get 0 which is diff than Diffx which is the same formula...

however on other examples I don't get 0...so I am perplexed to say the least.

Capture.PNG

cts:

load

     source,

     MemID,

     MemID & '\' & MemLoc & '\' & InvNo as MemMemInv,

     MemLoc,

     MemCust as MemCust,

     InvNo,

     InvDate,

     NetNoCore as cts

FROM

(qvd)

where InvNo = '01JE9482'

;

join(cts)

esc:

load

     //source,

     MemID & '\' & MemLoc & '\' & InvNo as MemMemInv,

     //MemLoc,

     MemCust as escMemCust,

     //InvNo,

     InvDate as escInvDate,

     NetNoCore as esc

FROM

(qvd)

where InvNo = '01JE9482'

;

STORE cts into r:\FromQV\ctsA&J.qvd;

drop table cts;

cts:

LOAD MemMemInv,

     source,

     MemID,

     MemLoc,

     MemCust,

     InvNo,

     InvDate,

     num(cts) as cts,

     escMemMemInv,

     escMemCust,

     escInvDate,

     num(esc) as esc,

     num(cts)-num(esc) as Diffx

FROM

(qvd);

exit Script;

1 Solution

Accepted Solutions
swuehl
MVP
MVP

2 Replies
swuehl
MVP
MVP

Maybe have a look at

Rounding Errors

brooksc57
Creator
Creator
Author

thanks swuehl...

that was actually my first thought but had been using the num(,) rounding technique so many had suggested.  obviously it doesn't work for all instances as well as rounding does.

was just getting ready to hit the round fx up again when I saw your email/response.

have a great day!

thx

Brooks