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

There is an alternative method for viewing Meditech Data Definitions that will show all ...

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

SUB is a Field Attribute not documented on Meditech's website. It allows you to define ...

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

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