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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable and formula problem

Status
Not open for further replies.

antmoe3

Programmer
Feb 24, 2006
32
US
I have the following forumla below. The goal is to have Cost_XX display in the report. I'm getting zero in the report. What am I doing wrong? What steps am I missing?

NumberVar Disc_Amt_V;
NumberVar Discount_V;
NumberVar Int_Cost_V;
NumberVar XCost_V;
NumberVar Cost_X;
NumberVar Cost_XX;


if {Command.Fst_Own_Rtl} = 0
then Disc_Amt_V = ({Command.ITM_QTY} * {Command.ITEM_LAST_COST})
and Discount_V = ((Disc_Amt_V * {Command.ITM_QTY}) * {Command.line_24})
and Cost_X = {Command.ITEM_LAST_COST}+({Command.ITEM_LAST_COST}*{Command.ROS_FRT_PCT})
else
if {Command.Fst_Own_Rtl} <> 0
then Int_Cost_V = ({Command.Cur_OWND_RTL}/{Command.Fst_Own_Rtl})
and XCost_V = (Int_Cost_V * {Command.ITEM_LAST_COST})
and Cost_X = XCost_V + (XCost_V * {Command.ROS_FRT_PCT})
and Cost_XX = Cost_X - Discount_V;

if ({Command.Cur_OWND_RTL} < {Command.Fst_Own_Rtl}) and {Command.MD_STAT} > 10
then ({Command.Fst_Own_Rtl} = {Command.Cur_OWND_RTL})
and Discount_V = ((({Command.Cur_OWND_RTL}/{Command.Fst_Own_Rtl}) * {Command.ITEM_LAST_COST}) * {Command.line_24}) * {Command.ITM_QTY}
else Discount_V = (({Command.ITEM_LAST_COST}*{Command.line_24}) * {Command.ITM_QTY})
and Cost_X = {Command.ITEM_LAST_COST} + ({Command.ITEM_LAST_COST} * {Command.ROS_FRT_PCT})
and Cost_XX = Cost_X - Discount_V;


if ({Command.Cur_OWND_RTL} >= {Command.Fst_Own_Rtl})
then Discount_V = (({Command.ITEM_LAST_COST} * {Command.line_24}) * {Command.ITM_QTY})
and Cost_X = ({Command.ITEM_LAST_COST} + ({Command.ITEM_LAST_COST} * {Command.ROS_FRT_PCT}))
and Cost_XX = Cost_X - Discount_V;


 
In your clauses following each "then", you should be using a colon followed by an equal sign :)=) instead of the equal sign alone, because you are assigning values to the variables.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top