mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/

 

 

Using Web 2.0 Applications to Create External Drop Down List for a Report OR Maintenance Application

m-Power applications give you a few quick and very easy ways to create a drop down list based off of the data within the file for a particular field: “A” and “D” for “A”scending and “D”escending dropdown lists and “B” for Cascading dropdown lists. But sometimes you may need some extra customization, and this is where External Drop Down Lists come in.

What is an External Drop Down List?
Usually, but not always, is all of the data you ever need to populate a field already in the file. In the cases where it is not, you could be limiting your users by not giving them all of the available choices. A great example of this is selecting states from a dropdown list. If your company has business in all of the states East of the Mississippi, but none West of it, your data files have no mention of all of the West coast states. If a user tries to add a record or select records from a drop down list using the User Defined Field Controls of “A”, “B”, or “D” they would not see any of these states. However using an external drop down list, they could see all 50 states. The other added benefit, is that you would need to do the following process once, then simply reference the external object in every application. You would never need to build this application more than once. For this example, we assume we already have a table registered to the Data Dictionary with 50 records, and 2 columns (state name & state abbreviation). The name of the table is “STATES”

  1. External Object Creation
    1. Click the “Retrievals” tab. Click the “Create” button.
    2. Specify a name for the application. Click “Accept.” Within File Selection, select the file that was created in Step 1. In our case, that is the file “STATES.” Select both fields.

    1. Sequence by States and click the “Preformat” Link
    2. With External Objects, we have the ability to show a description, but behind the scenes use a value. For states, this is perfect as not everyone may know all the state abbreviations. To specify the Value field, place a “V” within the user defined field control. To specify the Description, place a “D” within the user defined field control.
      (Please see the end of this document for a full reference list of User Defined Field Controls)

    1. After going back to the main Application Options screen, be sure to select the Web 2.0 Multiple Record Inquiry Servlet from the Applications Default Screen. (Note: Due to added performance and less complexity, the multi record inquiry has replaced the old External Object Inquiry Template. Anytime you wish to call any inquiry as an external object, be sure to select the Multiple Record Inquiry).

    1. Build and Compile this application.
  1. Configure the External Object
    1. Click the Data Dictionary Tab and click the “Manage External Objects” link.

Configure your external object to use the following parameters:

Note: Our class name is HURCKES.I01045s because the Retrieval built in Step 2 was Inquiry 1045 built in Data Dictionary Hurckes

For copy and paste purposes, the Method name has been listed here:          getSelect("Select a State",pName,pValue,"select",1)

    1. Click OK. Navigate to External Object 4150 and click the “Parameters” link for this external object.
    2. Since the field we are going to pass back and forth is the Abbreviation of the State (The “V”alue from above), we will set up our external object as such:

  1. Build the Report/Maintainer that will use this External Drop Down List
    1. Build your application – be sure that you select a file with a State Field of length 2 Alpha.

    1. The field circled above is key within this application as it will “receive” the value from the External List. To specify this, please specify a “K” in the user defined field control. This “K” tells the external object to map data to this field.
      Note: User Defined Field Control of “K” is always needed in Reports, but in a Maintenance application, this step can be omitted.
    2. Since we want our end user to select a state from a list, we will need to add this field as a record selection.

    1. Next we will need to be sure we select the “Web 2.0 Report Template”

    1. Lastly, we will need to call External Object 4150, which we made in Step 3. Click the “External Objects” link in the Applications Options screen.

    1. Notice that we selected Object 4150 and specified SMSTE as the field. Also notice that we selected the *Select location. This location is used for dropdown lists on the prompt page.
    2. Build, Compile, and Run the Report.

Notice that on the first screen listed above we see the full description of all the states specified in the physical file specified in Step 1. However, when we run the second screen listed above we see that the value returned was the two letter description ‘IL.’ This was because of the “V” and “D” specified in Step 2. Note: The same scenario could be followed if you wish to only have one value (No description, only Value). The only difference would be not specifying “V” or “D” in step 2. m-Power will know, by default, that the one field you selected is both the value and the description.

What should I specify for my User Defined Field Control?

Due to the flexibility of the templates, the answer depends on what template you are using. For example:

When building Inquiry templates, specify “V” for the “V”alue you wish to display

When building any other type of template (Reports, Summaries, or Maintainers), specify a “K” for the field you wish the value to be mapped.