none
Infopath setting due date to 15 business days

คำตอบ

  • Hi SPDEV2010,

    As you have probably seen, there is the "addDays" function in InfoPath that will allow you to add a specific number of days to a date value but this does not exclude weekends and holidays. You can use some custom XPATH expressions to not count weekends; however, unless you hard-code all holidays into a resource file in InfoPath there is no "dynamic" way to account for holidays. With this method, you would need to update that XML file, say, each year so you have all the current holiday dates. Someone has already created a sample like this - here is a link to where you can find the sample form:

    http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/

    Now, if you want this process to be dynamic then you will need to use code to calculate a future date that takes into consideration weekends and holidays.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    • ทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 21 มิถุนายน 2555 13:38
    21 มิถุนายน 2555 13:38
  • Hi SPDEV2010,

    We are seeing different results: I put in a begin date of 6/1/2012 and an end date of 6/22/2012 and it correctly returns 16 work days:

    If I change the start date to 6/4/2012, it correctly reflects 15 working days:

    

    Again, this is using the "WorkDaysCalc.xsn" sample from the site I referenced. So unless I am misunderstanding what you need, this sample provides the solution you asked for...other than holidays.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    • ทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 27 มิถุนายน 2555 12:36
    27 มิถุนายน 2555 12:36

ตอบทั้งหมด

  • Hi,

    Thank you for your post.

    I'm trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks & Regards,
    Emir


    Emir Liu

    TechNet Community Support

    20 มิถุนายน 2555 11:44
  • Hi SPDEV2010,

    As you have probably seen, there is the "addDays" function in InfoPath that will allow you to add a specific number of days to a date value but this does not exclude weekends and holidays. You can use some custom XPATH expressions to not count weekends; however, unless you hard-code all holidays into a resource file in InfoPath there is no "dynamic" way to account for holidays. With this method, you would need to update that XML file, say, each year so you have all the current holiday dates. Someone has already created a sample like this - here is a link to where you can find the sample form:

    http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/

    Now, if you want this process to be dynamic then you will need to use code to calculate a future date that takes into consideration weekends and holidays.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    • ทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 21 มิถุนายน 2555 13:38
    21 มิถุนายน 2555 13:38
  • Hi scott ,

                       I already refered to that article but it doesnt work properly. Can u do n let me know for 15 working business days just ignore holidays and just consider sat n sundays

    Regards,

    SPDEV


    SPDEV2010

    22 มิถุนายน 2555 9:26
  • Hi SPDEV2010,

    Actually it does work - I downloaded the sample that was attached to that blog called: Work Days Calculation and it works exactly as you need for business days. It ignores weekends and just returns the count of workdays. So when I select, say, 6/22/2012 for the Begin Date and 6/25/2012 for the End Date, the number of work days returned is 2 days. You just need to download that sample, review how that was implemented and incorporate that into your own XSN.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    22 มิถุนายน 2555 11:58
  • Still i have issue with 15 days calculation can u give me formula that need to be set in rule

    SPDEV2010 - MCTS

    25 มิถุนายน 2555 15:36
  • Hi SPDEV2010,

    I wouldn't be giving you anything more than what is in the sample. Did you download that XSN? Did you test it in the sample? Does the sample work as it does for me?? I cannot give you an exact expression since I don't have your data source. You need to simply implement what is in the sample into your XSN.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    26 มิถุนายน 2555 17:23
  • That infopath form works only for 2 days it doesnt works for 10 or 15 days. I tried to come up with logic but i couldnt as i did not understand current code

    SPDEV2010 - MCTS

    • แก้ไขโดย SPDEV2010 26 มิถุนายน 2555 18:27
    • ทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 27 มิถุนายน 2555 12:32
    • ยกเลิกการทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 27 มิถุนายน 2555 12:32
    26 มิถุนายน 2555 17:35
  • Hi SPDEV2010,

    We are seeing different results: I put in a begin date of 6/1/2012 and an end date of 6/22/2012 and it correctly returns 16 work days:

    If I change the start date to 6/4/2012, it correctly reflects 15 working days:

    

    Again, this is using the "WorkDaysCalc.xsn" sample from the site I referenced. So unless I am misunderstanding what you need, this sample provides the solution you asked for...other than holidays.

    Scott


    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    • ทำเครื่องหมายเป็นคำตอบโดย Scott He - MSFT 27 มิถุนายน 2555 12:36
    27 มิถุนายน 2555 12:36
  • Sorry i referenced wrong template datecheck.xsn. yes u r right it works

    SPDEV2010 - MCTS

    27 มิถุนายน 2555 12:42
  • Excellent!

    Scott Heim - Microsoft Office InfoPath and SharePoint Designer Online Community Support

    27 มิถุนายน 2555 16:58