SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Sep 2007
    Location
    USA
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Code to identify business instead of calendar days

    Hi-
    Is anyone familar with calculating business days versus calendar days within the Quality Center script editor.

    The following is the code that I wrote to update a date field ("BG_USER_59") when a defect is either Opened or Reopened and set the date to current day plus 90 days. We are trying to use the field to determine if sla's have been missed - we do not want to ding people for weekends and holidays when we give them 90 days to complete a task and we don't want to calculate manually. Any advice [img]/images/graemlins/confused.gif[/img]?

    Thanks!

    Select case FieldName
    Case "BG_STATUS"
    if Bug_Fields("BG_STATUS").Value = "Open" then
    Bug_Fields("BG_USER_59").Value = Now() + 90
    elseif Bug_Fields("BG_STATUS").Value = "Reopen" then
    Bug_Fields("BG_USER_59").Value = Now() + 90
    end if
    end select
    E-Learning Solutions
    Learn it! Live it! Love it!
    www.e-learningsolutionsllc.com

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Location
    Nashville, TN, USA
    Posts
    713
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Code to identify business instead of calendar days

    You'll have to write a custom function for this. The concept of "Business Days" is not global in nature. Each business defines this differently. The holidays you mention also very by business and culture. The following function could be expanded to track business days between two dates after you add to the recognized holiday list:

    <font class="small">Code:</font><hr /><pre>
    Function AdvanceBusinessDays(dDate, iDays)
    iCount = 0
    dDateToTest = dDate
    While iCount &lt; iDays
    dDateToTest = DateAdd("d", 1, dDateToTest)
    If IsBusinessDay(dDateToTest) Then
    iCount = iCount + 1
    End If
    Wend
    AdvanceBusinessDays = dDateToTest
    End Function

    Function IsBusinessDay(dDate)
    If Weekday(dDate) = vbSunday _
    Or Weekday(dDate) = vbSaturday Then
    ' It is the weekend
    IsBusinessDay = False
    Else
    ' Test for Holidays
    If Month(dDate) = 1 And Day(dDate) = 1 Then
    ' New Years
    IsBusinessDay = False
    ElseIf Month(dDate) = 7 And Day(dDate) = 4 Then
    ' July 4
    IsBusinessDay = False
    ElseIf Month(dDate) = 12 And (Day(dDate) = 24 Or Day(dDate) = 25) Then
    ' Christmas Eve / Christmas Day
    IsBusinessDay = False
    Else
    ' Not a Holiday
    IsBusinessDay = True
    End If
    End If
    End Function
    </pre><hr />

    Then you can use something like this:

    <font class="small">Code:</font><hr /><pre>
    Bug_Fields("BG_USER_95").Value = AdvanceBusinessDays(Now(), 90)
    </pre><hr />

    Hope this helps!
    Boyd Patterson
    Patterson Consulting, LLC
    www.patterson-consulting.net

    [i]Creator of Test Design Studio - Powerful IDE for QuickTest Pro[i]

  3. #3
    Junior Member
    Join Date
    Jul 2004
    Location
    Atlanta
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Code to identify business instead of calendar days

    Hi, I'm interested to hear if you ever implemented this in QC or the dashboard?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.34%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:33 AM.

Copyright BetaSoft Inc.