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.

Back to Blog

Related Articles

Detail Segment/Index File Lookup allows lookup into both Detail Segments and Index Files

At either the Detail Segment or Index File prompt, type the letter A followed by a blank space and...

Documenting NPR Field Attributes, Line Attributes and Footnotes

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

Detail Segment/Index File information screen during lookup

After pressing for a lookup for either Detail Segments or Index Files, press the number of the...