Location Filter not taking effect

ChessExpertChessExpert Member Posts: 103
Hello there experts, I’m just wondering why Inventory wasn’t calculating when I used the Location Filter.
Here is my code listing. ItemRec is local variable, Item.”No.” is a report DATAITEM.

ItemRec.RESET();
IF ItemRec.GET( Item."No." ) THEN BEGIN
ItemRec."Location Filter" := 'GREEN' ;
ItemRec.CALCFIELDS(Inventory)
retInventoryBalance := ItemRec.Inventory;
END;

Any ideas why is not considering my “Location Filter”.
Thanks a lot.

Answers

  • SavatageSavatage Member Posts: 7,142
    Hello there experts, I’m just wondering why Inventory wasn’t calculating when I used the Location Filter.
    Here is my code listing. ItemRec is local variable, Item.”No.” is a report DATAITEM.

    ItemRec.RESET();
    IF ItemRec.GET( Item."No." ) THEN BEGIN
    ItemRec."Location Filter" := 'GREEN' ;
    ItemRec.CALCFIELDS(Inventory)
    retInventoryBalance := ItemRec.Inventory;
    END;

    Any ideas why is not considering my “Location Filter”.
    Thanks a lot.

    It doesn't look like a filter. It looks like you're defining "Location filter" as GREEN -> :=
    ItemRec.RESET();
    IF ItemRec.GET("No." )
    THEN BEGIN
        If ItemRec."Location Filter" = 'GREEN'
         THEN BEGIN
           ItemRec.CALCFIELDS(Inventory); 
           retInventoryBalance := ItemRec.Inventory;
         END;
    END;
    

    unless you want to use find & setfilter's?
  • Alex_ChowAlex_Chow Member Posts: 5,063
    You shoudl use:
    ItemRec.SETRANGE("Location Filter",'GREEN');
    
  • ChessExpertChessExpert Member Posts: 103
    Hello Alex, that's the one. Thank you so much. I appreciate it. ChessExpert.
  • sunnyksunnyk Member Posts: 280
    HI,
    To this i want to know if i want only those records from Item where location contains work green. For example GREEN-Stock or Stock-Green.
    I kNow i cannot use @*Green* in this case because it works only with field type code or text.
Sign In or Register to comment.