Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value from positive to negative based upon alternate field

Status
Not open for further replies.

Wyldeasu

Technical User
Jul 9, 2003
2
US
I am currently using crystal to report on data from a ODBC. Our database chooses to show all numeric values as positive, relying on a receipt/debit field to verify whether the numeric field is an inflow or outflow. I am trying to change the value to correctly reflect a negative number for outflows. I have been tried the following If Then statement

If {R/D} = "D" then {N} = {N}*-1 else {N} = {N}

This statements still provides my positive figures correctly, but my "D" numbers disappear instead of swithing to a negative. Any suggestions?
 
Try:

If {R/D} = "D" then
{N}*-1
else
{N}

The only other issue might be if you have nulls, in which case you'd get null, so use:

if isnull({n}) then
0
else
If {R/D} = "D" then
{N}*-1
else
{N}

-k

 
I tried the suggested but with no success. Instead of producing a negative number, it is producing a 0, which is why for some of my summations they dissapear completely ( several of the groups contain nothing but "D" valued numbers. Is there something I can do to make the figure end up negative instead of 0? Is this possibly a field issue?
 
You never menmtioned a summation.

Please share what you're trying to do, not just parts of it.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top