Why not just use the MB "Month Begin" and ME "Month End"  keyword default in 
NPR.  These can be used just like the T for today or T-1 for yesterday.  ME-1 
will give you the last day of the prev month.

Susan
From: [email protected] [mailto:[email protected]]
Sent: Thursday, May 14, 2009 11:48 AM
To: [email protected]
Subject: [talkbws] RE: NPR Report date parameters ?

This is very similar to what Paul has done, but I have a "leap year check" that 
is referenced by the script for the month of February.

Sub leapYearCheck()
currYear = Format(Date, "YYYY")
getDate = "2/28/" & currYear
Feb = CDate(getDate)
workingMonth = Format(DateAdd("M", -2, Date), "MM")
workingYear = Format(DateAdd("M", -2, Date), "YY")
strTodaysDate = Format(Feb, "yymmdd")
strTomorrowsDate = Format(Feb + 1, "yymmdd")
intTodaysDay = Mid(strTodaysDate, 5, 2)
intTomorrowsDay = Mid(strTomorrowsDate, 5, 2)
If intTodaysDay = "28" And intTomorrowsDay = "01" Then lydate = "28" 'No leap 
year
If intTodaysDay = "28" And intTomorrowsDay = "29" Then lydate = "29" 'Leap year
Exit Sub
End Sub

Sub KHDS()
Select Case workingMonth
Case Is = "01"
fromDate = "0101"
toDate = "0131"
Case Is = "02"
leapYearCheck
fromDate = "0201"
toDate = "02" & lydate
Case Is = "03"
fromDate = "0301"
toDate = "0331"
Case Is = "04"
fromDate = "0401"
toDate = "0430"
Case Is = "05"
fromDate = "0501"
toDate = "0531"
Case Is = "06"
fromDate = "0601"
toDate = "0630"
Case Is = "07"
fromDate = "0701"
toDate = "0731"
Case Is = "08"
fromDate = "0801"
toDate = "0831"
Case Is = "09"
fromDate = "0901"
toDate = "0930"
Case Is = "10"
fromDate = "1001"
toDate = "1031"
Case Is = "11"
fromDate = "1101"
toDate = "1130"
Case Is = "12"
fromDate = "1201"
toDate = "1231"
End Select
Key "KHDS"
Wait 0.25
Key "{tab}{tab}"
Wait 0.25
Key fromDate ' 1st thru last of 2 months ago i.e. March = Jan1 - Jan31
Key workingYear
Wait 0.25
Key "{tab}"
Wait 0.25
Key toDate
Key workingYear
'continue doing stuff

--------------------------------------------------------------------
Heather Castillo
HPMIN Analyst/Module Coordinator
Information Systems
Hays Medical Center
785.623.5084 office
785.623.5594 fax
[email protected]<mailto:[email protected]>

"Shoot for the moon...even if you miss, you'll always land among the stars."
________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, May 14, 2009 10:42 AM
To: [email protected]
Subject: [talkbws] RE: NPR Report date parameters ?

Leap year = broken.


Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
(tm): 
[email protected]<mailto:[email protected]>
[cid:[email protected]]
Send a "thank you<http://intranet.christushealth.org/spiritBuck/Default.asp>" 
to someone!
________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, May 14, 2009 10:36 AM
To: [email protected]
Subject: [talkbws] RE: NPR Report date parameters ?

Here is one way to accomplish what you are trying to do within BW.  Although 
this is not clean as an experienced programmer would write it, it should work.
Thanks!
Paul


Paul Brungardt
Clinical Analyst
HaysMedicalCenter
PH: 785-623-2196
PG: 785-650-5989


-----------------------------------------------------------------------------------------------------------------------------------------------------
CURRENTDATE = Format(Date, "mmddyy")
CURRENTMONTH = Left(CURRENTDATE, 2)
CURRENTDAY = Mid(CURRENTDATE, 3, 2)
CURRENTYEAR = Right(CURRENTDATE, 2)


If CURRENTMONTH = "01" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "02" Then ENDMONTHDAY = "28"
If CURRENTMONTH = "03" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "04" Then ENDMONTHDAY = "30"
If CURRENTMONTH = "05" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "06" Then ENDMONTHDAY = "30"
If CURRENTMONTH = "07" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "08" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "09" Then ENDMONTHDAY = "30"
If CURRENTMONTH = "10" Then ENDMONTHDAY = "31"
If CURRENTMONTH = "11" Then ENDMONTHDAY = "30"
If CURRENTMONTH = "12" Then ENDMONTHDAY = "31"


If CURRENTDAY < "16" Then
REPORTSTARTDATE = CURRENTMONTH & "01" & CURRENTYEAR
REPORTENDDATE = CURRENTMONTH & "15" & CURRENTYEAR
End If

If CURRENTDAY > "15" Then
REPORTSTARTDATE = CURRENTMONTH & "16" & CURRENTYEAR
REPORTSENDDATE = CURRENTMONTH & ENDMONTHDAY & CURRENTYEAR
-----------------------------------------------------------------------------------------------------------------------------------------------------




________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, May 14, 2009 9:14 AM
To: [email protected]
Subject: [talkbws] NPR Report date parameters ?

Good morning...

I have a script that will run an NPR report that once completed will run on the 
1st and 15th of every month. I need the script to be able to evaluate what day 
is it running and based from that,  input either the 1st day of the month 
(05/01/09) to the 15th day of the month (05/15/09) if it's being run on the 
15th OR input the 16th (05/16/09) and the last day of the month (05/31/09) 
which of course will change month to month depending on what month it is if 
it's being run on the 1st of the month...

I'm kind of at a loss on how to accomplish this...Anyone will to share their 
thoughts or ideas on it?

Thanks!

Travis D. Hanson, Application Analyst
Anderson Hospital
6800 State Route 162
Maryville, IL  62062
618.288.5711 ext 5862
[email protected]<mailto:[email protected]>
---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [email protected]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx
---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [email protected]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx
---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [email protected]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx

<<inline: image001.jpg>>

Reply via email to