Filter issue in version 4.00 SP2

RoelofRoelof Member Posts: 377
Hi,

Did anyone of you experienced a filter issue in Navision 4.00 SP2?
I have a very weird filter problem on the Reservation Entry table.
I try to set a setrange on a field in a function of a CodeUnit. That didn't work. I copied the EXACT data in a standalone codeunit for testing and it works.

Any help is welcome.

Thanks.
Roelof de Jonghttp://www.wye.com

Comments

  • ara3nara3n Member Posts: 9,257
    could you put your code in here?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RoelofRoelof Member Posts: 377
    It's a very straight forward set of codelines:

    WITH ResEntry DO BEGIN
    SETCURRENTKEY("Source ID","Source Ref. No.");
    SETRANGE("Source ID",ReqLine.'REQ.');
    SETRANGE("Source Batch Name",'DEFAULT');
    SETRANGE("Source Ref. No.",30000);
    SETRANGE("Source Type",246);
    SETRANGE("Source Subtype",0);
    IF FIND('-') then //I even tried FINDSET but no results either.
    message('Found records');
    END;

    Notes:
    ResEntry is a local var, so reset is not needed.
    ResEntry = Reservation Entry table.
    When I remove the filters it finds the records.
    When I copied over the exact code to a new standalone CodeUnit it works fine.
    Roelof de Jonghttp://www.wye.com
  • ara3nara3n Member Posts: 9,257
    SETRANGE("Source ID",ReqLine.'REQ.'); ? is this a typo?

    In you code where it is not working
    before doing find('-')
    put this code

    messsage(ResEntry.getfilters);


    and write down what the filter and post it here.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RoelofRoelof Member Posts: 377
    Sorry, Reqline.'REQ.' is a typo. It should be 'REQ.'.
    Roelof de Jonghttp://www.wye.com
  • RoelofRoelof Member Posts: 377
    Message('Filters = %1',ResEntry.Getfilters);
    That is what I already did. I has the correct filters. The funny thing is, it's working in a standalone codeunit, but not here. I thought maybe somewhere in the code earlier ResEntry records might have been deleted and no COMMIT being set, but the entries are there. It just should give a recordset back.
    Roelof de Jonghttp://www.wye.com
  • ara3nara3n Member Posts: 9,257
    maybe they are deleted when you running your code. Do this insert another reservation entry manually in the table just like the other entry, but change the "Source Ref. No." to 3 instead of 30000. Change you code to filter
    SETRANGE("Source Ref. No.",3);

    See if it finds the record.

    It's basically almost imposible to replicate this, so need your help to get down to the problem.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    Are you using MS SQL or Native DB?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • RoelofRoelof Member Posts: 377
    I figured it out. It was indeed the wrong spot in the code. Basically what happened was, when you run the Req.Worksheet.CarryOutActionMessage it'll delete the Reservation entries during the process.
    Boy that took me while.
    Thanks for your support.
    Roelof de Jonghttp://www.wye.com
  • ara3nara3n Member Posts: 9,257
    You are welcome. Reservation is a tricky thing to work with and every version of navision has made changes to it. And guess what version 5 has changes as well. They stated that it will be easier.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.