WANT the MEDITECH Reports BLOG via EMAIL?

Your email:

About MEDITECH Reports

MEDITECH Reports is an online reference for NPR Report Writing and not affiliated with MEDITECH, Inc @ http://meditech.com. To learn more about NPR report development using the Meditech Report Writer read more here.

View John Sharpe's profile on LinkedInI'm your host, John Sharpe, a MEDITECH Report Writing Consultant in Spokane, WA. More about me.


Email John

Follow Comstock Software on Twitter 

Sign up for the MEDITECH Reports Blog; details to attend MEDITECH workshops are sent out 1 week in advance to all MEDITECH Report blog subscribers.

These MEDITECH Workshops are sponsored by Donna Carroll at the MEDITECH Community Bulletin

MEDITECH NPR & RW RESOURCES:

Ascii Table: For NPR Report Writer
Loop Builder: For NPR Macros
Key Codes: For CDS Attributes
List Builder: For NPR Macros
MT Report Names: For NPR Reports
MT Structure Viewer: For Physicals
Strings: Format & Sort

MEDITECH Reports

Current Articles | RSS Feed RSS Feed

Find And Replace String


Ever needed to replace a character in a report's output?

Next time you do, try something like this:

{";",":",/TXT}^@STRING.FIND.REPLACE^/TXT

STRING.FIND.REPLACE
; Input(s): /PARAMS
; Output(s): /STRING
; Author: John Sharpe
; Usage: {@QUOTE,"`",/TXT}^@STRING.FIND.REPLACE^/TXT
/PARAMS,/PARAMS|0^FIND,/PARAMS|1^REPLACE,/PARAMS|2^STRING,
DO{STRING#(L(STRING,FIND)^P) (STRING$P)_REPLACE_(STRING%P)^STRING},
STRING^/STRING

QUOTE
D(34)


Comments

A colleague, Josh Panchley, recently helped me do this exact same thing. It's just another option... This particular example shows how to replace a colon with a dash. 
 
 
 
0-1^x, 
 
""^TRANS, 
 
DO{x+1^x<128 TRANS_IF{x=84 D(45);D(x)}^TRANS} 
 
 
 
84 is the ascii code for : and 45 is the ascii code for -. 
 
 
 
Now take you text and translate the string 
 
 
 
@field'~TRANS^TEXT 
 
Posted @ Tuesday, December 22, 2009 7:26 AM by Sandra Rollins
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics

Receive email when someone replies.