Can anyone tell me why I am not getting right value if I have sell_activity?
WhilePrintingRecords;
numberVar tempbuy := {a.BUY_ACTIVITY};
numberVar tempsell := {a.SELL_ACTIVITY};
numberVar tempnet = 0;
numberVar templong := {Morning_Adjustments_Element.yest_pcs_basis_actual_oi};
numberVar tempshort := {Morning_Adjustments_Element.SHORT_PCS_BASIS_QTY};
numberVar x := 0;
numberVar y := 0;
// Reduce the buy activity and the short position by the smaller of the two.
if tempbuy >= tempshort
then
x = tempshort
else
x = tempbuy;
tempbuy = tempbuy - x;
tempshort = tempshort - x;
// Reduce sell activity and the long position by the smaller of the two
if tempsell >= templong
then
y = templong
else
y = tempsell;
tempsell = tempsell - y;
templong = templong - y;
//if there are buys AND sells left, take the net and add it to the remaining longs
tempnet = tempbuy - tempsell;
templong = templong + tempnet;
if templong < 0
then
templong = 0;
// return result as the minimum long
templong
WhilePrintingRecords;
numberVar tempbuy := {a.BUY_ACTIVITY};
numberVar tempsell := {a.SELL_ACTIVITY};
numberVar tempnet = 0;
numberVar templong := {Morning_Adjustments_Element.yest_pcs_basis_actual_oi};
numberVar tempshort := {Morning_Adjustments_Element.SHORT_PCS_BASIS_QTY};
numberVar x := 0;
numberVar y := 0;
// Reduce the buy activity and the short position by the smaller of the two.
if tempbuy >= tempshort
then
x = tempshort
else
x = tempbuy;
tempbuy = tempbuy - x;
tempshort = tempshort - x;
// Reduce sell activity and the long position by the smaller of the two
if tempsell >= templong
then
y = templong
else
y = tempsell;
tempsell = tempsell - y;
templong = templong - y;
//if there are buys AND sells left, take the net and add it to the remaining longs
tempnet = tempbuy - tempsell;
templong = templong + tempnet;
if templong < 0
then
templong = 0;
// return result as the minimum long
templong