Comparing UOM

SavatageSavatage Member Posts: 7,142
edited 2005-02-25 in Navision Attain
What code is it to compare two units of measure?

One Item
Two Units Of Measure (Each & Deal)
Each always 1
Deal Always > 1

I want to pop a message up that says "Both Qty Per Units Of Measure Are The Same" (or something)

I was thinking simply
IF "Code" = 'DL' and "Qty. Per Unit Of Measure" := 1 THEN
ERROR('Wrong QTY Entered!");

But i must be missing some parenthasis or something

If somone types in the wrong info & tries to exit the UOM form when entering a new item.

Code = Code
Qty Per Unit Of Measure = Decimal

I've tried a few codes but it's not working the way I want it to.. I'm looking for a new perspective From Y'all.

Thanks

Comments

  • DenSterDenSter Member Posts: 8,307
    I don't really understand exactly what you want, other than that you want to know how to prevent a user from entering two UOM's with the same 'Qty per UOM'. If that is the case, you should create a new function in the 'Item Unit of Measure' table called 'CheckQtyPer' or something. This function searches for Item Unit of Measure records for the same Item and the same qty per, and raises an error if it finds one. Call this function from the OnInsert as well as the OnModify trigger. You could also add the call to the Qty per UOM field.

    The function looks something like this (I have not tested this, so tweak as you go please):
    locItemUOM, local Record var, subtype "Item Unit of Measure"
    
    locItemUOM.RESET;
    locItemUOM.SETFILTER("Item No.",'=%1',Rec."Item No.");
    locItemUOM.SETFILTER("Qty. per Unit of Measure",'=%1',Rec."Qty. per Unit of Measure");
    IF locItemUOM.FIND('-') THEN BEGIN
      ERROR('There already is an Item Unit of Measure with Qty. per Unit of Measure ' + 
            FORMAT("Qty. per Unit of Measure"));
    END;
    

    HTH
  • SavatageSavatage Member Posts: 7,142
    that's a great idea - i think these long hours are starting to take a toll! :?

    thanks for the suggestion
  • DenSterDenSter Member Posts: 8,307
    yeah I hate long hours. Come to think of it, I hate short hours too :whistle:
Sign In or Register to comment.