1. Home
  2. Knowledge Base
  3. Deprecated Documentation
  4. Introduction to User Defined Functions (UDF)

Introduction to User Defined Functions (UDF)

UDF Introduction


All applications created with m-Power employ SQL to access the database. SQL, by itself, is a very powerful language. A database User Defined Function (UDF) allows users to extend the power of SQL. UDF’s are a powerful yet simple way to perform routine data transformations, calculations, and complex SQL logic. Database vendors (IBM, Oracle, Microsoft, Sun, etc.) have specific requirements for creating UDFs; most allow the UDF to be written in SQL or another programming language such as C or RPG.

m-Power makes it easy to employ this new feature. A UDF can be defined at a global level to m-Power. An m-Power logical field can be defined at a table level to return a value from a UDF call. m-Power users then can select this logical UDF field as if it were any other database field and use it to display, sort, and select data in any m-Power application.

The uses for such a powerful feature are endless. A short list of examples:

Dates: Convert a numeric date field into a true date field for use in selecting or sequencing records. Or extract the year and month to perform on-the-fly period subtotaling in reports.

Order Totals: Access other DB tables and calculate an order total value by summing the order line price times the line quantity over many Order Detail records, making it available as a selectable field from the order header table.

On Hand Quantity: Calculate a product’s current on hand valuation by combining several fields, if your database requires some logic to calculate such a value.

The use of UDF’s in m-Power is well-documented in the following articles. Please see these documents for further details:

Register your UDF:


Create Logical Fields with UDF’s:


mrc Date Conversion UDF’s:


Sample UDF Source Code:


Updated on September 30, 2021

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support