mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/
|
|
Creating Drop-Down Lists from an External File (For use with Reports)
Often times, especially when
creating a report, you would like a user to specify a value from a drop-down
list. Let’s say you have a report that breaks salesman down by state and you
want to run a record selection that lists all 50 states. You already have a
file that contains all 50 states and would like to use that for your report.
The answer is to create a drop down list from an external file. Below we will
walk through the entire process. Note: The
process outlined below is only for
users of the Classic Web/Servlet Templates. If you are using Web 2.0 templates,
you should follow this
document.
Overview
Step 1 – Build External Object
Inquiry over State File
Step 2 – Build the External Object
Reference under the Data Dictionary Tab
Step 3 – Map the Correct Parameter
Step 4 – Call the External Object
from a Report
Note: Steps 1 through
3 only need to be done once. All future applications can utilize this object
for a drop down list. The only step that needs to be repeated each time is Step
4.
Step 1
Our first step is to build the
External Object Inquiry over our file that contains the data for our drop down
list. For this example it is the STATES file. After I select my “STATES” file,
I need to select two fields – The name of the state and the abbreviation. After
sequencing, select Preformat. We need to tell this object which values will be
the “D”escription and which will be the “V”alue. That is, I wish for our end
user to see the entire name of the state but when the data is written to the
file, I only want the abbreviation.

Be sure to select the “External
Object Inquiry.” Build/Compile your Object.

Step 2
Since our object is now
successfully created, we need to register it within the m-Power environment. To
do this, click on the Data Dictionary tab and click the “Manage External
Objects” link. Click the “Create” button.

Create your Drop-Down List based
upon the screen shot above.
Note: Object Type must be set at M,
as this is a Java Method.
The class name, HURCKES.I01905s,
is the address of the object we created in Step 1.
The Method name,
For Drop-Down List output: getSelect("Select a
State", pName, pValue, "select", 1)
This tells the external object how
to behave. You can change “Select a State” to whatever text you want your
dropdown list to have by default. You can also choose to have your output as a
radio button by changing “select” to radio (Note: If choosing radio button, be sure to increase the 1 to a
greater number, as this value determines how many buttons are listed per row):
For Radio Button output:
getSelect("Select a State", pName, pValue, "radio", 10).
Click Accept.
Step 3
Now since we have our External
Object registered, we must register the parameter that will be passed from the
report to our application we built in Step 1.
Search for the object you just
created, and click on the “Parameters” link for this object.
Since the field that we specified
as the “V”alue field in Step 1 is a 2A field, this parameter must also be 2A.
Remember: The
parameter you create must match the attributes of the field you specified as a
“Value field in Step 1.
Click Accept.
Step 4
Now that we have created our
External Object, Referenced it, and created the parameter it is time to create
the Report that will use it.
After you have selected the proper
file, fields, and sequencing, select the “External Objects” link.

Based on the screen above, you can
see we are calling the Object we referenced in Step 2, passing along the
parameter we defined in Step 3. Also notice that the location we are using is
entitled *Select. This location is needed to create the Drop-Down list (or
Radio buttons).
Click the Accept Button.
Next, we need to create a record
selection for this field (After all, we do want our end user to select a
state).

Lastly, we need to tell our report
to map the parameter listed above to the record selection. This is done on the
Preformat screen. Select the field in question and place a “K” as the user
defined field control.

Build/Compile your application.
When the Application is run, we
are shown this screen. Note: Notice
the “Select a State” text, this is seen because we specified it when we created
the reference to this object.

Clicking on the drop down, I am
shown the following screen:

Choosing

Notice the “Selection Criteria”
box, it has a selection criteria of “IL,” not “