coutdown field - InfoPath Dev
in

InfoPath Dev

coutdown field

Last post 05-09-2012 06:41 AM by kac.dev. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 03-05-2006 01:20 PM

    coutdown field

    I need to have a field that displays the number of days left for a project. I have a field showing todays date, and one showing the project deadline date. I'd like to display the remaing days in a 3rd field. I'd also like to disable the 3rd control once the deadline has been met.
  • 03-05-2006 01:30 PM In reply to

    This article has information regarding Date Calculations in InfoPath, which might answer your first question.

    http://blogs.msdn.com/infopath/archive/2005/01/25/360318.aspx
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-05-2006 01:35 PM In reply to

    perfect!!!

    The only problem is code makes cry! :>
    Is there a way I could do this with the fields value formula?
  • 03-05-2006 02:05 PM In reply to

    Unfortunately there is no DateDiff formula in InfoPath. You have use code.
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-05-2006 02:19 PM In reply to

    Looks like I'll have to use code and a few bottles of wine to deal with this!!

    Thanks
  • 03-05-2006 02:22 PM In reply to

    What language are you using? I can write a little piece of code to help out.
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-05-2006 02:42 PM In reply to

    Not doing anything with code. I'm just using rules and formula for what I need.

    ...should I send money??? :>
  • 03-05-2006 02:46 PM In reply to

    It sounds like you don't have Visual Studio. Your options will be either VBScript or JScript. The code will be a bit different for each. Are you familiar at all with VB?
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-05-2006 03:07 PM In reply to

    I have a confession to make. I've got no coding knowledge whatsoever. I work for a company that does lit support(e-discovery, digital forensics, legal database production). We have don't have any programmer's on our staff and somehow I've gotten stuck heading up the devolpment of tracking systems for our workflow.Sadness!!! I was doing fine with rules and formula until I started coming up with more ambitiuos designs. Looks like I'm going to have to learn basic coding!!!


    Long story short I'm frightened and lost in the wonderful world of coding!!!
  • 03-05-2006 05:21 PM In reply to

    Here is the code sample using VBScript. You need to call it from OnAfterChange event.


    Sub UpdateDateDiff
    Dim fromDate
    Dim toDate
    Dim days
    Dim daysNode

    set daysNode = XDocument.DOM.selectSingleNode("/my:myFields/my:DaysRemaining")

    fromDate = Trim(XDocument.DOM.selectSingleNode("/my:myFields/my:FromDate").text)
    toDate = Trim(XDocument.DOM.selectSingleNode("/my:myFields/my:ToDate").text)

    if Len(fromDate) = 0 Or Len(toDate) = 0 Then
    daysNode.text = "n/a"
    else
    fromDate = CDate(fromDate)
    toDate = CDate(toDate)
    days = DateDiff("d", fromDate, toDate)

    ' Determine whether the xsi:nil attribute is set for this
    ' element. If so, remove the xsi:nil attributes so that
    ' the value can be set.
    if Not IsNull(daysNode.getAttribute("xsi:nil")) then
    daysNode.removeAttribute("xsi:nil")
    end if
    daysNode.text = CStr(days)
    end if
    End Sub
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-06-2006 08:02 AM In reply to

    Thanks I'll give it a shot.
  • 11-05-2008 11:29 AM In reply to

    • Scotl
    • Not Ranked
    • Joined on 11-05-2008
    • Posts 4

    This script will work in InfoPath 2003?

  • 11-06-2008 08:26 AM In reply to

    Yes, it should, as this is VBScript.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-09-2012 06:41 AM In reply to

    Dear Sir, I am new user of Infopath and have no basic knowledge of script. Please any one help me to how to put these code and where ? Thank you
Page 1 of 1 (14 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.