Thanks, I never thought about turning the date around. I was hoping that BWS would treat the date the same way VB6 does and convert it to a number (i.e. 03/22/08 = 39529 and 08/24/06 = 39014). I'll try turning the date around, if that doesn't work I try point my step to a sub-routine and see if that makes a difference.
Thanks again. Brian Bennett Affinity Health Systems Systems Analyst PBS\Clinic Billing (920)628-9055 [EMAIL PROTECTED] -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2008 10:43 AM To: [email protected] Subject: [talkbws] RE: [talkbws] RE: Comparing Dates One thing I think you want to be careful of when comparing your date values below, is that you are comparing them as strings, which means that 12/20/2008 will be less than 9/01/2008 (since string comparisons are looked at 1 character at a time, and 1 comes before 9 in string comparisons). Of course, if you format the strings with 2 digit months, then this would solve this scenario. But what if they cross years? Then 01/01/2008 will show as Less Than 12/31/2007! There's a few ways to handle this. The first would be to format your dates as strings in the yyyymmdd format. The other way, which is the way I prefer is to convert the date strings into dates (using variables) and then comparing them. ' Declare Variables Dim originalDate as Date Dim currentDate as Date ' Get original Date originalDate = CDate(Left$(D("1"),8)) ' Get current Date - Date only value with no time, though it probably wouldn't matter. currentDate = CDate(Format(Now(), "mm/dd/yy")) ' Compare Date Values If currentDate = originalDate Then ... Ryan Rush OBS Development Specialist Providence Health & Services 503.215.4441 [EMAIL PROTECTED] ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] Sent: Thu 10/9/2008 6:53 AM To: [email protected] Subject: [talkbws] RE: Comparing Dates Hi Brian, I got this code to work. The only difference is that I didn't pull the date from meditech, I just set it equal to the current date. These were the dates in my file: 11/28/08 03/09/08 10/09/08 The first time through it went to step "Check Anyhow", the second it made it to "Bad Date" and the third "correct date". Maybe try formatting "mm/dd/yy" with those "/" in there. F("OrgDate") = Format(Left$(D("1"), 8), "MM/DD/YY") F("Date") = Format(Now, "MM/DD/YY") If F("Date") = F("OrgDate") Then Step = "CORRECT DATE" Exit Sub ElseIf F("Date") < F("OrgDate") Then Step = "CHECK ANYHOW" Exit Sub Else 'current date is greater than date in file Step = "BADDATE" Exit Sub End If End Sub Ambur Tiller Adena Health System Programmer Analyst Information Technology 272 Hospital Road, Chillicothe, OH 45601 Tel: (740)-779-7854 Email: [EMAIL PROTECTED] From: [email protected] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2008 9:26 AM To: [email protected] Subject: [talkbws] Comparing Dates Morning all, I'm have a bit of an dilemma this morning. I'm comparing Dates (equal or less than) and thought I had it working last night. I have a pre-defined date in my datastation and want to check it against the viewed date from Meditech. This is my latest coding modification F("OrgDate") =Left$(D("6"),8) '03/22/08 F("Date") =Trim$(View(Row:=Row, Col:=22, Length:=8) ) '10/24/06 If F("Date")= F("OrgDate") then Step = "Correct Date" End if ' no problems here, works just fine If F("Date")< F("OrgDate") then Step = "Check Anyhow" End ' I thought this was working, but it turns out it is only checking DD for the condition. If I change the code to this; F("OrgDate") =Format(Left$(D("6"),8),"MMDDYY") '032208 F("Date") =Format(Trim$(View(Row:=Row, Col:=22, Length:=8) ),"MMDDYY") '102406 If F("Date")= F("OrgDate") then Step = "Correct Date" End if If F("Date")< F("OrgDate") then Step = "Check Anyhow" End I don't think the MMDDYY actually converts the data to a date, if it did, the less than statement would be true, but it remains false. Any thoughts for a solution? p.s. each of these are in different steps, I don't have them all crammed into one rule. :) p.p.s Thom, any chance one of the next BWS releases will have an "auto-save" function? Thanks. Brian Bennett Affinity Health Systems Systems Analyst PBS\Clinic Billing (920)628-9055 [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 ****************************************************************** This email and any files transmitted with it are proprietary and confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager at [EMAIL PROTECTED] Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. No employee or agent is authorized to conclude any binding agreement on behalf of Adena Health System with another party by email without express written confirmation from Adena Health System authorized individuals. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Adena Health System, 272 Hospital Road, Chillicothe, Ohio, USA, http://www.adena.org <http://www.adena.org/> ****************************************************************** --- 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
