Options

Report updating values depending on item variation

JlTJlT Member Posts: 18
Hello!

I´m trying to create a report updating prices in a table with variations of items.

IF NewPriceNormalCall <> 0 THEN BEGIN
"Contract Standard Price".SETRANGE("Price Type","Price Type"::"Normal Call");
NewPrice := NewPriceAlarmCall + "Contract Standard Price"."Unit Price";
"Contract Standard Price"."Unit Price" := NewPrice;
"Contract Standard Price".MODIFY;
END;
IF NewPriceExtraCall <> 0 THEN BEGIN
"Contract Standard Price".SETRANGE("Price Type","Price Type"::"Extra Call");
NewPrice := NewPriceExtraTime + "Contract Standard Price"."Unit Price";
"Contract Standard Price"."Unit Price" := NewPrice;
"Contract Standard Price".MODIFY;
END;

As long as only condition one is met the update runs smoothly, but if option 2 runs, both variations gets modified. I guess I´m doing something wrong with the filters but I can´t figure out what.

Best Answer

Answers

  • Options
    Wisa123Wisa123 Member Posts: 308
    After reading the code, I dont really get what you are trying to achieve, and I doubt anybody here will.
    Your SETRANGE's in this snippet actually do nothing at all.

    However feel free to PM me the object, if you mind sharing it in the thread. This shouldn't take long.
    Austrian NAV/BC Dev
  • Options
    matttraxmatttrax Member Posts: 2,309
    It would be good if you posted the object. We're only guessing at what some of the code is. The NewPrice conditionals, for example, are those functions or variables? Can't understand custom code snippets without context.
  • Options
    JlTJlT Member Posts: 18
    Thank you! As I guessed I was using the filters wrong, not including some sort of FIND. Now it works perfectly. I also try to give more context next time.
Sign In or Register to comment.