mrc logo mrc logo
  • m-Power m-Power
    What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • Solutions Solutions
    What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the web MS Access to the web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs and Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Services Services
    Development Services Training Mentoring
  • About About
    Overview Partners Press Releases Careers Events Contact Blog
  • Support Support
    Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • External Objects & UDFs
  • Regular Expression External Object
Back to Manual

Regular Expression External Object

 

Beginning with the May 2013 release of m-Power, developers will be able to use a Regular Expression Java external object for parsing field values. The most common example of when this would be done is with the Email Upload template, in order to grab a piece of data from one section of the email. In the example below, we will be grabbing the Invoice Number from the email subject and storing it in the INVNO field.

  1. The first step is to create the proper regular expression and store it in an application calculation in the maintainer. Regular expressions are incredibly powerful and complex, and as such are well beyond the scope of this documentation. However, there is plenty of information online as well as tools to automatically generate regular expressions, such as this one, which is what was used for this example. If you want to test a regular expression you have created prior to using it, try our tool here. For this example, we are assuming the invoice number will come in the subject in the format "Invoice No. XXXXX". Therefore, our expression will be /Invoice No\\. (\\d+)/ and our calc will look like the below screenshot.



     
  2. Once you have added this expression as a calc, we need to register an associated external object. To do this, navigate to "Admin Menu" -> "Custom Code" -> "External Objects" -> "Create New Object." Give your object a name and description, and be sure the object type is set to Java Method. For the Class name, use the following:

    com.mrc.ext.MrcExpression

    For the method, use:

    match

    When completed, your object should look like the following screenshot.



     
  3. Next, we have to set up exactly three parameters. The first is the field you want to parse, the second is the regular expression to use, and the third is the field you want to return the result to. In our example, we will map the first parameter to the email subject, the second to the application calc we created in step 1, and the third to field INVNO.
  4. Now that our object has been created, we need to register it to our maintainer. To do so, click the Maintenance button, and then click the Edit button next to the desired maintainer. Once the Application Menu has been opened, click the External Object button. On this screen, select your object from the dropdown, the desired location (*BEFOREACT in this example), and then map the parameters to your fields, as discussed in the previous step.

    Note: If your field does not appear in the parameter dropdown, you have incorrectly defined the length/decimal and this must be fixed before proceeding.
  5. Once added, compile/recompile this application to load in the new logic.

    Note: You do not need to overwrite anything when only adding/modifying an external object.
  6. Now, at runtime, the external object will check the value of the subject, parse the number, and store this parsed value in the database in the INVNO field for easy filtering/sorting.

    Regular Expression Tester

    Calculation equal to: "//"
    String to parse:   
     
    Result:   
    Calc type:   
    Calc Length:   

Created: May 21, 2013 | Modified: June 12, 2017

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

Freemarker Dates Report Java Data Dictionary Performance Application Properties Maintainers Database DB2 Form Validation Maintainer Excel Email Bootstrap Templates Prompt Screens Compiling Graph Properties Summaries Retrievals Tomcat Video Bar Graphs Graphing Dropdowns Admin Getting Started Production App Properties Administration SQL Build Process Retrieval Security Advanced External Objects mrc-Productivity Series RPG Calculations Parameters Popular Reports Record Selections m-Painter Graphs

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© 2024 mrc. All rights reserved.