How filter dates with a another date field on a report

DarkHorseDarkHorse Member Posts: 389
Hello, I am making a report that works with dates. I have created a field type date in the Request Form called "datefilter" so that it appears in the Option eyelash.
Report shows sale orders and purchase ones from a reference. I want that this date acts as a filter date in these orders. For sale orders "Shipment Date" and for of purchase ones "Date Confirmation". So, when indicating a date in "datefilter", would want that it filtered by date shipment and date confirmation respectively, putting the amounts according to that filter date in one section that I created in report; I don't want to use the "Shipment Date" and "Date Confirmation" by other reasons. How can I do it?
Thank you very much.

Comments

  • vikram7_dabasvikram7_dabas Member Posts: 611
    Dear concern
    Write ur in this way:

    Item.SETRANGE(Item."Date Filter",StartDate,EndDate);

    where StartDate and EndDate are variables with Datatype Date.
    Vikram Dabas
    Navision Technical Consultant
  • DarkHorseDarkHorse Member Posts: 389
    Thank you!!! it works perfectly. Only one question more please. My report has two bodys for table, it's on the second body when I put this line that you have indicated me; the idea is that, on the first body shows all the purchase orders and sales one asociates to a item and on the second body the same purchase orders and sale orders filtred buy the "datefilter" field (StartDate,EndDate) that I've created. I've put the instruction on the second body and filter it correctly but also the first. How can I do that?, I only want to filter the second body (because after I want to sum the quantity). I don't know if I explain myself well, I know it's a litle strange.
    Thank you very much for your help.
  • mootsoomootsoo Member Posts: 70
    Hello
    I don't know my question is same with DarkHorse's
    My problem is this:
    I have one report, it has date filter. User gives that date. And i need to use that date in other C/AL, to take range with other table. But i couldn't do that.
    Please give me an advice

    Best Regards
    bye my work, bye navision
  • garakgarak Member Posts: 3,263
    mootsoo wrote:
    .... I have one report, it has date filter. User gives that date. And i need to use that date in other C/AL, to take range with other table. But i couldn't do that. ...

    if the user enter a date in the, for example Item-, Requestform you can get the value in this datefilterfield like:

    TheDateFilter := MyDataItem.getfilter(MyDateFieldOnRequestForm);


    Regards
    Do you make it right, it works too!
  • mootsoomootsoo Member Posts: 70
    ok thanks garak.
    i will try this way.
    bye my work, bye navision
  • mootsoomootsoo Member Posts: 70
    MyDateFieldOnRequestForm= "ReportName"."TabName"."FilteredDate"-?
    MyDateFieldOnRequestForm= "ReportName"."FilteredDate"-?
    i'm doing like this.
    But it says FilteredDate is unspecified variable.
    I have declared "ReportName" to report variable.
    and i dont get clear about "MyDataItem". It must be table-?
    bye my work, bye navision
  • garakgarak Member Posts: 3,263
    The user entered the date in a tables based request form (first DATAITEM), correct?
    You need the value of this filter to work with it in an other (second) DataItem, correct?
    If both is yes, you can get the DateFilterValue from the first DataItem with:

    //MyDateTextVariable variable of type text

    MyDateTextVariable := NameofTheFirstDataItem.getfilter(NameofTheDateField); //getfilter returns the value of the "NameofTheDateField" in the first Dataitem.

    Now you can work with "MyDateTextVariable". for example to use it as filterconstruct (setfilter()) in the second dataitem.

    Regards
    Do you make it right, it works too!
  • mootsoomootsoo Member Posts: 70
    Yes both is yes. Thanks & Sorry for asking too much

    Regards
    bye my work, bye navision
  • garakgarak Member Posts: 3,263
    No problem,. for this the forum exist ;-)
    Do you make it right, it works too!
  • mootsoomootsoo Member Posts: 70
    one more question.
    NameOfFirstDataItem must be table? It's can't be a report?
    What is the FilterConstruct?
    Because setfilter is using only in table. There must be declared the table of our MydatetextVariable. But now it's only a date. Need to specify a table. But it doesn't have a table.
    bye my work, bye navision
  • mootsoomootsoo Member Posts: 70
    i have write like this
    evaluate(datevariable, mydatetextavariable);
    setfilter(datevariable, Table."datefieldforFilter");
    bye my work, bye navision
  • garakgarak Member Posts: 3,263
    Please show the whole report here as text (copy in messagebody
    
    ) and set a sign please where you need the modification.
    then it's easier to help and understand correct what you want.

    Regards
    Do you make it right, it works too!
  • mootsoomootsoo Member Posts: 70
    Filter is working only in one table, or in 2 tables.
    In my case filtering from one table. But Mydatetextvariable doesn't have any tables. Mydatetextvariable is only text variable, or it can converted to date variable.
    Right now i don't have any code. If i can do this then i will write my code. Because i'm using that Mydatetextvariable once.
    But i don't know it is possible.
    bye my work, bye navision
  • mootsoomootsoo Member Posts: 70
    TagName TagType SourceType DataSource
    vat_invoices Element Text <vat_invoices> /indentation 0/
    vat_info Element Text <vat_info> /indentation 1/
    title Element Table <Company Information>(Company Information) /indentation 2/
    tin Element Field <Company Information>::VAT Registration No. /indentation 3/
    taxpayer Element Field <Company Information>::Name
    begin_date Element Text <begin_date>
    end_date Element Text <end_date>
    sell_sum Element Text <sell_sum>
    sell_vat Element Text <sell_vat>
    sell_total Element Text <sell_total>
    purch_sum Element Text purch_sum
    purch_vat Element Text purch_vat
    purch_total Element Text purch_total
    no_vat Element Text no_vat
    with_vat Element Text with_vat /indentation 3/
    invoice Element Table <Vendor Ledger Entry>(Vendor Ledger Entry) /indentation 2/
    invoice_no Element Text invoice_no /indentation 3/
    saler_tin Element Text saler_tin
    saler_name Element Text saler_name
    purchaser_tin Element Text purchaser_tin
    purchaser_name Element Text purchaser_name
    invoice_date Element Text invoice_date
    goods_amount Element Text goods_amount
    vat_amount Element Text vat_amount
    invoice_amount Element Text invoice_amount
    goods Element Text goods/indentation 3/
    no Element Text no
    goods_name Element Text goods_name/indentation 4/
    quantity Element Text quantity
    count Element Text count
    unit_price Element Text unit_price
    price Element Text price/indentation 4/
        BEGIN
             
             amountsum:=0;
             amountvat:=0;
             
           begin_date:=FORMAT(PurchInvHeader."Date Filter");
             VendorLedgerEntry.SETRANGE("Posting Date", PurchInvHeader."Date Filter", VendorLedgerEntry."Posting Date");
             Date");
             
             IF  VendorLedgerEntry."VAT Amount (LCY)" <> 0 THEN
             BEGIN
             invoice_date   := FORMAT(VendorLedgerEntry."Posting Date");
             goods_amount   := FORMAT(VendorLedgerEntry."Amount (LCY)");
             vat_amount     := FORMAT(VendorLedgerEntry."VAT Amount (LCY)");
             invoice_amount := FORMAT(VendorLedgerEntry."VAT Amount (LCY)"+VendorLedgerEntry."Amount (LCY)");
            
            
    
             amountsum:=amountsum+VendorLedgerEntry."Amount (LCY)";
             amountvat:=amountvat+VendorLedgerEntry."VAT Amount (LCY)";
    
    
             
             END;
    
           
    END;
    


    VendorLedgerEntry- Table
    PurchInvHeader - Table
    Date Filter - field, type is date, fieldclass-flowfilter
    bye my work, bye navision
  • mootsoomootsoo Member Posts: 70
    this codes are not working. no error occured.
    or it is not possible to take value like that?
    invoice_date   := FORMAT(VendorLedgerEntry."Posting Date");
             goods_amount   := FORMAT(VendorLedgerEntry."Amount (LCY)");
             vat_amount     := FORMAT(VendorLedgerEntry."VAT Amount (LCY)");
             invoice_amount := FORMAT(VendorLedgerEntry."VAT Amount (LCY)"+VendorLedgerEntry."Amount (LCY)");
    
    bye my work, bye navision
Sign In or Register to comment.