merge 2 dates into date filter field

fmhiguefmhigue Member Posts: 290
I got w dates:

Starting date - Date
Ending Date - Date

I have another field Date Filter. I want to put those into that one because I want to use it to get sales from Value Entry table.

Any ideas?

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi fmhigue

    use

    setrange( "Date filter", "strating date", "ending date" );

    setfilter( "date filter", format("starting date")+'..'+format("ending date"));
    also works
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • fmhiguefmhigue Member Posts: 290
    Hi Dave T:
    Sorry I did not explain myself correctly.

    Date Filter I will use it as parameter on Qty Sold field. That is a flow field from Value Entry.

    Let me write it down:
    Qty Sold:

    Method: Sum
    Table: Value Entry
    Field: Invoiced Quantity
    Table Filter:

    Posting Date=FIELD(Starting Date)
    Note:
    Instead of Starting Date I want Date filter in here.


    Item Ledger Entry Type=CONST(Sale),
    Location Code=FIELD(Location Code),
    Item No.=FIELD(Item No.),
    Source No.=FIELD(Customer No.)))

    I hope I did myself clear this time
  • DaveTDaveT Member Posts: 1,039
    Hi fmhigue,

    Ok, if you set
    Posting Date=FIELD(Date Filter)

    and declare the "Date Filter" as type datefilter it will work when you use the setrange or setfilter as I said and calcfields( "Qty Sold" ).

    Look at field 72 Sales (Qty.) on the item table for how it treats this as standard.

    Hope this clear it up for you.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • fmhiguefmhigue Member Posts: 290
    Dave T:
    It is working now. I appreciate your help.
    I just dont get how Date Filter knows it should use Starting and Expiration date.
  • DaveTDaveT Member Posts: 1,039
    Hi fmhigue,

    Datefilter is a special type of field and Nav knows how to treat it.

    It look at the filter set on the variable, instead of the value, and appies the filter to what it looks up.

    i.e. if you look at date filter variable, the value is not set but the filter is set. You can see what the filter is by using the getfilter command.

    Glad to help :mrgreen:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • fmhiguefmhigue Member Posts: 290
    Date Filter is taking since the beggining of the company to today.

    I want date filter to take starting date.. expiration date.

    I setup Date Filter - Date - FlowFilter
  • DaveTDaveT Member Posts: 1,039
    Hi fmhigue,

    :-k :-k
    Check that the filter is set correctly... try using
    MESSAGE( GETFILTER( "Date Filter" ) );
    to see how it is set
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • fmhiguefmhigue Member Posts: 290
    It is working now
Sign In or Register to comment.