Greetings, 

Here is exactly how Rules UI works and how add your own code to it. More detail 
than you need – but knowledge can be power as they say!

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The Rules UI –  generates  two things on the fly – and both of those things – 
consider them read-only

RuleShell 

Sub routine for  “the script name”

 

Rules script code is only edited from the UI – modifying any of the routines 
listed above will not work.

Steps and Rules can only be added and edited from the UI

 

Actions are the only thing that can be “typed edited” in the VBA window

 

There is one – and only one – to “type edit” an action using the VBA window 

 

Right click on the Rule and select Edit Action – a Sub routine is generated 
(Sub Edit_Action)  and you can put code into that routine. This code can be 
individual commands, calls to any (public) sub or function within the Project 
or both.

 

When you close VBA and click Yes to the Save Actions dialog –what was placed 
into the Edit_Action sub routine will be added to the Rule’s action – and 
you’ll see that code in the Rules UI.

 

I saw a comment about using a “common” module – that is a very good advice!

One thing I recommend is when you write a Sub or Functions that will be used by 
a Rules script – put them into your own module –not the Scripts module. Makes 
things easier to re-use!

 

Regards,

Thom

 

 

Thom C. Blackwell

Vice President, Technical Services

Boston Software Systems

(866) 653-5105 ex 807

www.bossoft.com <http://www.bossoft.com/> 

 

Visit us at HIMSS Orlando in Booth 2180

 

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: Thursday, February 17, 2011 10:10 AM
To: Talk
Subject: RE: [talkbws] vb in rules based scripting

 

Yes Heather, at the end of the file, usually after the RuleShell subroutine.  
BWS will not allow code additions in the rules subroutine, and it would not be 
a good practice anyway.

 

John Taylor

Systems Analyst, Information Systems | Augusta Health

Office:  (540)332-4882 | www.augustahealth.com

 

From: [email protected] [mailto:[email protected]] 
Sent: Thursday, February 17, 2011 10:05 AM
To: [email protected]
Subject: RE: [talkbws] vb in rules based scripting

 

Hi John, 

 

Are you creating your Public Function sub at the very end of the VB code in the 
VBA editor? I’ve just never understood where you go in and add the VB code to 
be referenced within your actions…

 

Thanks!

 

------------------------------------------------

Heather Castillo

HPMIN Applications Analyst

Hays Medical Center

785.623.5084 office

785.623.5594 fax

[email protected] <mailto:[email protected]> 

________________________________

From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, February 16, 2011 1:03 PM
To: [email protected]
Subject: RE: [talkbws] vb in rules based scripting

 

What type of examples are you looking for Sarah?

 

Here is an example for a file download…

 

Step Print Destination Download

Title/condition, etc.

Actions:

Key "@_clickoffsetx:12"

key "@_click:Target"

key "^{End}"

key "{BS}"

key GetFileName("Out")

key "@_click:OK"

 

 

Public Function GetFileName(pType As String)

    If Trim(LCase(pType)) = "out" Then

        GetFileName = "\\some path\some file name 
<file:///\\some%20path\some%20file%20name> " & Format(Now, "MMDDYY") & ".txt"

    Else

        ' update

        GetFileName = "\\some path\some other file name 
<file:///\\some%20path\some%20other%20file%20name> " & Format(Now, "MMDDYY") & 
".txt"

    End If

End Function

 

 

John Taylor

Systems Analyst, Information Systems | Augusta Health

Office:  (540)332-4882 | www.augustahealth.com

 

From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, February 16, 2011 1:55 PM
To: [email protected]
Subject: [talkbws] vb in rules based scripting

 

Hi, 

Would someone be willing to share a rules based script (preferably for Meditech 
C/S 5.6x) that incorporates visual basic in the script?  

 

Your help would be greatly appreciated!

 

Sarah Koenigsman

HPMIN Applications Analyst

[email protected]

785.623.5023

 

 

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

 

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

Reply via email to