Question

I am receiving the error

Operand Types Are Not Compatible With The Operator

in the title when trying to compare two "real" datatypes.

Can anyone help me out with what is wrong?

public void clicked()
{
    real    localAnnualUsage    = itemSetup_DS.AnnualUsage();
    real    localSalesPrice     = itemSetup.StockPrice;
    real    localCost           = itemSetup.StockCost;
    real    localstockInventAvg = itemSetup.StockInventAvg;

    real    localTurnAndEarn;
    real    localAnnualGP;
    real    localAvgInvCost;
    ;

    localAvgInvCost = itemSetup.StockInventAvg;

    if (localStockInventAvg != itemSetup_StockInventAvg)
    {
        localAvgInvCost = itemSetup_StockInventAvg;
    }

    //...
}

The error happens with on the line of the conditional.

Was it helpful?

Solution

Most likely your itemSetup_StockInventAvg variable is a real control, not a real.

Try using:

if (localStockInventAvg != itemSetup_StockInventAvg.realValue())

or better (because the control stores the result in itemSetup.StockInventAvg):

if (localStockInventAvg != itemSetup.StockInventAvg)

Update: This makes no sense, since localStockInventAvg was set to itemSetup.StockInventAvg the line before.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top