Date Filter

mrigyamrigya Member Posts: 124
Hi All,

CAn anyb'dy tell me what is wrong with this code, as it is displaying only one value that is FIRST value found in table and is getting repeated through out the report. :(


UInvoiceNo:='';
UPostingDate:=0D;
UItemNo:='';

ValueEntry.RESET;
ValueEntry.SETRANGE(ValueEntry."Item Ledger Entry Type","Value Entry"."Item Ledger Entry Type"::Sale);
ValueEntry.SETFILTER(ValueEntry."Posting Date",'>%1',StartDate);
IF ValueEntry.FIND('-') THEN BEGIN
// ERROR('%1.....',"Value Entry".COUNT);
UInvoiceNo := ValueEntry."Document No.";
UPostingDate := ValueEntry."Posting Date";
UItemNo:=ValueEntry."Item No.";
END;


THANKS AND REGARDS

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi

    This depends on your report design. I am assuming that your dataitem is based on Value Entry and the code is in the onaftergetrecord trigger. This will find the first each time. The code should be in the onpredataitem trigger.

    Can you give more info.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • mrigyamrigya Member Posts: 124
    DaveT wrote:
    Hi

    This depends on your report design. I am assuming that your dataitem is based on Value Entry and the code is in the onaftergetrecord trigger. This will find the first each time. The code should be in the onpredataitem trigger.

    Can you give more info.

    Hiii...
    Yes U are right i m doing the same.
    Actually i want to make a report on Inventory Valuation, in which, whatever the date user enters through the request form, the Values corresponding to the Date LESS THAN what User entered should b displayed on one side as OPENING STOCK of DATAITEm, Value Entry and the Values corresponding to EQUAL TO that date on another side as PURCHASE and VAlue corresponding to Greater than that date on another side of same data item(Value Entry) as UTILIZATION..My problem is i m getting the value of OPENING STOCK and PURCHASE absolutely right means less than and equal to of that date ...but getting only first record found in case of greater than value of that date by this code


    //UTILIZATION

    UInvoiceNo:='';
    UPostingDate:=0D;
    UItemNo:='';

    ValueEntry.RESET;
    ValueEntry.SETRANGE(ValueEntry."Item Ledger Entry Type","Value Entry"."Item Ledger Entry Type"::Sale);
    ValueEntry.SETFILTER(ValueEntry."Posting Date",'>%1',StartDate);
    IF ValueEntry.FIND('-') THEN BEGIN
    // ERROR('%1.....',"Value Entry".COUNT);
    UInvoiceNo := ValueEntry."Document No.";
    UPostingDate := ValueEntry."Posting Date";
    UItemNo:=ValueEntry."Item No.";
    END;


    THANKS AND REGARDS
  • DaveTDaveT Member Posts: 1,039
    Hi Mrigya,

    To fix your problem you will need to loop around the value entry with
    ValueEntry.RESET;
    ValueEntry.SETRANGE(ValueEntry."Item Ledger Entry Type","Value Entry"."Item Ledger Entry Type"::Sale);
    ValueEntry.SETFILTER(ValueEntry."Posting Date",'>%1',StartDate);
    IF ValueEntry.FIND('-') THEN 
      BEGIN
        repeat
           UTILIZATION += valueentry."qauntity invoiced";
        until valueentry.next = 0;
      END; 
    

    Have a look at the standard Inventory Valuation Report as I think it will provide a lot of what you need.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.