current year function to filter by current year - InfoPath Dev
in

InfoPath Dev

current year function to filter by current year

Last post 11-27-2006 04:53 PM by Greg Collins. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 11-21-2006 12:52 PM

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    current year function to filter by current year

    How do I get the current year from a table that has dates in the 11/6/2006 Format. I'm trying to filter information only for the current year. I found a article about at

    http://kjellsj.blogspot.com/2005/04/using-xpath-preceding-sibling-in.html

    however it did not work in the Xpath box.
  • 11-21-2006 01:14 PM In reply to

    Re: current year function to filter by current year

    Keep in mind that the "display" of a date isn't necessarily representative of the stored value of the date. In InfoPath dates are stored in the sortable XML format: "yyyy-mm-dd" even if InfoPath displays them as "m/d/yyyy". So when working against a formatted date (or time or number) you must ignore the formatting and deal with the actual value stored in the field. Make sense?
  • 11-21-2006 01:17 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: current year function to filter by current year

    Yes Greg,

    This does makes sense, but how do I only sum up monthly expenses for that current year. I'm guessing with a filter, but what type of Xpath for date do I include.
  • 11-21-2006 03:00 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: current year function to filter by current year

    Greg and InfoDev's,

    I hard coded it, but need to find the Xpath that compares the current date. Here is the hard coded Xpath, and it just sums up for the expenseReportDate= "2006". If I can find the function that says current year in Xpath, I can solve it. Any help would be appreciated. Thanks.

    sum(xdXDocument:GetDOM("TOSSReceive")/dfs:myFields/dfs:dataFields/d:TOSS/@monthlyExpenses[../@employeeDepartment = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:TOSS/@employeeDepartment and contains(../@expenseReportDate, "2006")])
  • 11-22-2006 07:40 AM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: current year function to filter by current year

    Does anyone know the Current Year Xpath function for InfoPath?
  • 11-22-2006 12:13 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: current year function to filter by current year

    Success.....I found the code on the internet and edited the code. For future reference here is the Xpath to select a specific department and only the current year from an SQL Server database. I'm getting good.

    sum(xdXDocument:GetDOM("TOSSReceive")/dfs:myFields/dfs:dataFields/d:TOSS/@monthlyExpenses[../@employeeDepartment = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:TOSS/@employeeDepartment and contains(../@expenseReportDate, substring(xdDate:Today(), 1, 4))])
  • 11-22-2006 12:54 PM In reply to

    Re: current year function to filter by current year

    Cool!
    Patrick Halstead
    Project Manager at Qdabra
  • 11-27-2006 04:53 PM In reply to

    Re: current year function to filter by current year

    Glad you were able to get this resolved!
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.