web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Filter bincode lookup field using bin columns

(0) ShareShare
ReportReport
Posted on by 200

bincode lookup fields gets the data from bincontents page. But it needs to be filered from a Boolean field name 'block' if its false from bin page. bincode is common for both bin and bincontents page.

For this scenario I got answer from the following link.

community.dynamics.com/.../271416

and the code is

In the BinContent table, add a flowfield called Bin Blocks defined as Lookup(Bin.Blocks WHERE (Location Code=FIELD(Location Code),Code=FIELD(Bin Code))).

Then, in your lookup:

BinContent.SETRANGE(BinContent."Item No.",ItemNo);

BinContent.CALCFIELDS("Bin Blocks");

BinContent.SETRANGE("Bin Blocks",FALSE); //TRUE or FALSE depending on the filter you want to apply

IF PAGE.RUNMODAL(0,BinContent) = ACTION::LookupOK THEN

......

But for same thing bincode lookup filed to filtered from another Boolean field name dedicated(i.e it should get  filterered using two columns). Can anyone suggest?

*This post is locked for comments

I have the same question (0)
  • anandb313@gmail.com Profile Picture
    200 on at

    I used following code it filters if anyone one Boolean is checked.

    //

    BinContent.SETRANGE(BinContent."Item No.",ItemNo);

    BinContent.CALCFIELDS("Dedicated Blocks");

    BinContent.CALCFIELDS("Bin Blocks");

       IF BinContent.FINDSET THEN

         REPEAT

          BinContent.SETRANGE("Bin Blocks",FALSE);

          BinContent.SETRANGE("Dedicated Blocks",FALSE);

         UNTIL BinContent.NEXT  = 0;

    //

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    The FINDSET cycle is unuseful for filtering.

    You can do exactly like in the previous post:

    BinContent.SETRANGE(BinContent."Item No.",ItemNo);

    BinContent.SETAUTOCALCFIELDS("Dedicated Blocks","Bin Blocks");

    BinContent.SETRANGE("Bin Blocks",FALSE);

    BinContent.SETRANGE("Dedicated Blocks",FALSE);

    IF PAGE.RUNMODAL(0,BinContent) = ACTION::LookupOK THEN

    ...

  • anandb313@gmail.com Profile Picture
    200 on at

    Your code works for only if dedicated or blocks(anyone) checked, but I need if both checked and that particular bin code should not be shown.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    The code provided shows all Bin Content lines where Bin Blocks is false and Dedicated Blocks is false. If this is not what you want, can you explain your requirement? When do you want to see a BinContent record? Under what conditions?

  • anandb313@gmail.com Profile Picture
    200 on at

    If  Both bin blocks and dedicated blocks is true, those records should not be shown. But your code resembles if the bin blocks is true or dedicated block is true the record is not shown. I am asking in 'And' condition.

    For example I have 3 lines of records A, B, C

    For Case 1, Bin Blocks is True and Dedicated Blocks is False.

    For Case 2,Dedicated Blocks is True and Bin Blocks is False.

    For Case3, both blocks(dedicated and bin) is True. So this line should not be shown. This case is my requirement. For first 2 cases the records should be shown.

    Thanks in Advance.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Ok. You can use MARK for this:

    BinContent.SETRANGE(BinContent."Item No.",ItemNo);

    BinContent.SETAUTOCALCFIELDS("Dedicated Blocks","Bin Blocks");

    if BinContent.FINDSET THEN

    REPEAT

    BEGIN

     if (BinContent."Dedicated Blocks" = FALSE) OR (BinContent."Bin Blocks" = FALSE) then

       BinContent.MARK(true);

    END

    UNTIL BinContent.NEXT=0;

    BinContent.MARKEDONLY(TRUE);

    IF PAGE.RUNMODAL(0,BinContent) = ACTION::LookupOK THEN

    ...

  • anandb313@gmail.com Profile Picture
    200 on at

    Its working...!!!Thank You very much Stefano....

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans