November 4, 2021

MAGIC function for returning the number of leading characters

l (that's a lowercase L) is the MAGIC function for returning the number of leading characters for a string.  It takes two arguments, the first of which is the string to search for leading characters, and the second of which is the character to check for. 

 l(0009876,0) returns 3 because the string 0009876 has three leading characters that match the second argument, 0.

This comes in handy on occasion, especially when creating a user-defined field that performs string extraction based upon the number of leading characters within a string.  Some facilities have their patient account numbers beginning with a long string of zeros and need those zeros excluded from the report.  Sometimes the number of leading zeros varies.

Topics: MEDITECH, Report Writing, Tips & Tricks, Magic Function, Magic System, NPR Report, CS System

You Might Also Enjoy

BFI stands for Before Input. BFI attributes can come in pairs, just like FCL attributes. ...

Suppose you want to produce a list of RXs for all current Inpatients. This example will ...

Entering documentation on Field Attributes, Line Attributes, and Footnotes can come in ...

The PRE Field Checks occur before the FCL Field Checks. They are executed after the ...

There are two NPR Macros that can either launch a PC-based executable or automatically ...