Thanks Thom, I've got it in a sub now, but after each record, the set 
createtextfile over-writes the previous created text file.  I did a search in 
the BWS help file and came up with the OpenTextFile solution.  But it kept 
failing.  I'm not completely sure, but I think there is a small typo in the 
instructions.  To prevent the file from being over written after each 
subsequent record I'm creating the log file on the first step and then 
appending using OpenTextFile some steps later;

Sub Create_Log_Notes()
'Log notes created at the beginning of the script.
Dim fs, a
If f("Ste") = "E" Then
    f("sSite") = "STE"
    Else
    f("sSite") = "MMC"
End If

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("I:\Systems Analyst\BWSFiles\zzz_Rdm_Logs\ErrorLog" & 
f("sSite") & ".txt", True)

    a.WriteLine ("Error Log Generated by RDM-BAR Notes Script")
    a.WriteLine ("Account        Error")
End Sub

Sub Enter_Log_Notes()
'Log notes entered after each account # entered into Meditech
Dim fs, a
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("I:\Systems Analyst\BWSFiles\zzz_Rdm_Logs\ErrorLog" & 
f("sSite") & ".txt", ForAppending, True)

        If f("gACT") = "True" Then
            a.WriteLine f("ACT") & "     Succeeded"
        Else
            a.WriteLine f("ACT") & "     No such patient Account"
        End If
    a.Close

End Sub

I kept failing to open the text file at set a = fs.OpenTextFile if I included 
ForAppending, if I excluded ForAppending the line executed, but would get a bad 
disk error at a.WriteLine.  In the help file it has
Const ForReading = 1, ForWriting = 2, ForAppending = 3.  I believe it should be 
ForAppending = 8 (as above) unless 3 will work, but I am missing a library?  
Now that that's done, I can play with the additional Datastation document.  
I've used more than one datastation doc in the past, but not for logging.  I've 
got a feeling it will be much easier than the above, but it will be good to 
know both ways...some day.


Brian Bennett
Affinity Health Systems
Systems Analyst
PBS\Clinic Billing
(920)628-9055
[email protected]



________________________________
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, December 08, 2009 9:20 AM
To: [email protected]
Subject: [talkbws] RE: Quick Question

Greetings,
You could put the below in a Sub routine and call it from a Rule...
The d.Report option would make things easier  -  but you've already done the 
work that d.Report would do...
You don't need to create another Datastation file though, the Report can 
happily include your own data and data from the file itself.
When you are on an "error record" in your script, Set D("Status") and then set 
the fields you want reported:
D("Message")="Account not found"
D("Special Field2")=...

Be sure of course you've configured the report to include d("Message") etc.

Regards,
Thom


Thom C. Blackwell
Product Manager
Boston Software Systems
(866) 653-5105 ex 807
www.bossoft.com<http://www.bossoft.com/>

Sign up for my weekly 
webinar!<http://www.bostonworkstation.com/customer_center/special_events.aspx>

LEGAL NOTICE Unless expressly stated otherwise, this message is confidential 
and may be privileged. It is intended for the addressee(s) only. Access to this 
E-mail by anyone else is unauthorized. If you are not an addressee, any 
disclosure or copying of the contents of this E-mail or any action taken (or 
not taken) in reliance on it is unauthorized and may be unlawful. If you are 
not an addressee, please inform the sender immediately, then delete this 
message and empty from your trash.

From: [email protected] [mailto:[email protected]]
Sent: Tuesday, December 08, 2009 10:08 AM
To: Talk
Subject: [talkbws] Quick Question

How would (or could) I do something like the following in Steps?

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("I:\Systems Analyst\BWSFiles\zzz_Rdm_Logs\errorLog" & 
sSite & F("RPT") & ".txt", True)
    a.WriteLine ("Error Log Generated by RDM-BAR Notes Script")
    a.WriteLine ("Account        Error")
        If F("gACT") = "True" Then
            a.WriteLine (F("ACT") & "     Succeeded")
        Else
            a.WriteLine (F("ACT") & "     No such patient Account")
        End If

VB is no trouble, but I don't know how to make it Global when used with a step 
based script.

I'm transferring notes from one module to another and then emailing the Error 
Log at the end.  Would I be better off opening another datastation doc and then 
D?.Report ing it?

Brian Bennett
Affinity Health Systems
Systems Analyst
PBS\Clinic Billing
(920)628-9055
[email protected]



  ________________________________
CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may 
contain confidential and privileged information for the use of the designated 
recipient(s) named above. If you are not the intended recipient, you are hereby 
notified that you have received this communication in error and that any 
review, disclosure, dissemination, distribution or copying of it or its 
contents is prohibited. If you have received this communication in error, 
please notify the sender at the electronic mail address noted above and destroy 
all copies of this communication and any attachments. Thank you for your 
cooperation.
---
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

________________________________
CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may 
contain confidential and privileged information for the use of the designated 
recipient(s) named above. If you are not the intended recipient, you are hereby 
notified that you have received this communication in error and that any 
review, disclosure, dissemination, distribution or copying of it or its 
contents is prohibited. If you have received this communication in error, 
please notify the sender at the electronic mail address noted above and destroy 
all copies of this communication and any attachments. Thank you for your 
cooperation.


---
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

Reply via email to