mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/
|
|
Redirecting a Maintainer Application to another Page
There
will be numerous times you wish to redirect to another page after a user has
performed an action on a file (Update, Delete, or Add). One of the most common
uses of the redirect is after you have a user fill out a form. Once this is
completed, you wish to redirect them to a confirmation page. There are two ways
to accomplish this: Simple Mode (No User Entered Parameters) and Complex Mode
(User Entered Parameters). In Simple Mode, the Confirmation Page would tell
them that their information has been entered successfully, but it would be
unable to pass any parameters the user has just entered. Conversely, in Complex
Mode, the confirmation page would display the same confirmation page, however
this time it would be able to list all of the information the user entered in
the previous screen.
For
these examples, we will assume that our confirmation page is Inquiry 100,
within MRCWORKLIB. Note: You can
redirect to any page you wish, it does not have to be m-Power related.
Simple Mode
In
Simple Mode, we will be hard coding the link directly into the source of our
HTML. Build/Compile your Maintainer, then enter the
“Source” mode through m-Painter. Scroll to the end of the document, you will
see the following text:
<INPUT
TYPE="hidden" NAME="add_redir"
value="" >
<INPUT
TYPE="hidden" NAME="upd_redir"
value="" >
<INPUT
TYPE="hidden" NAME="dlt_redir" value="" >
<INPUT
TYPE="hidden" NAME="all_redir" value="" >
add_redir -- After add successfully,
upd_redir -- After update successfully,
dlt_redir -- After delete successfully,
all_redir -- After one of all above
successful, and all above must be blank.
You
can specify a redirection URL by manually inserting the appropriate code within
the ‘value’ field. For instance:
<INPUT
TYPE="hidden" NAME="add_redir"
value="MRCWORKLIB.I00100s">
The above text states that after a
record has been added to this file,
call Inquiry 100 within MRCWORKLIB.
Complex Mode
While
this is titled Complex Mode, there is nothing difficult about the following
steps, only that there are more steps to follow than in the Simple Mode. Again,
the advantage of this is that your redirected page can pass parameters that the
user has just entered.
Here
is an overview of the steps needed for this process:
Step
1: Create Confirmation Page
Step
2: Create External Object for Redirection
Step
3: Create Parameter to pass to Confirmation Page
Step
4: Create Maintainer and Call External Object
Step
1:
My
maintainer will feature an end user entering in customer information, then they will see that information on a confirmation page.
My first step is to create the confirmation page. My confirmation page is a
simple Single Record Inquiry, keyed by Customer Number. I have painted the
application to resemble a very basic confirmation page:

Step
2:
I
now need to create an External Object that will call the Inquiry (I00100) that
we created in Step 1.
Click
the Data Dictionary tab, and click the “Manage External Objects” link.

Note: The Object Type is “U” (short for URL
redirect). Also, notice the class name and method name are blank. This is
intentional. Place the destination of the redirect within the “Classpath name.”
Also, notice that we have added “?slnk=1”
– this is needed as we will be smartlinking to our
new record and only wish to see this record.
Click
“Accept”
Step
3:
Now
that the Object has been created and referenced we need to create the parameter
that will be passed. Since we sequenced by Customer Number in Step 1, we will
need to pass CUSNO in this step.
Navigate
to your new object and click the “Parameters” button.
Add
a new parameter. In our case, our screen will look like this:

Note: The Parameter name and size specifications must match that of the
field within the data dictionary.
Click
Accept.
Step
4:
Create
the Maintenance Application and call this object.
After
I have added all of the appropriate fields and sequencing, I need to click the
“External Objects” link.

Notice
that we have selected the object made in Step 2. Notice the location, *AFTERADDRE,
which means that any time a new record has been added to the file, call this
object and redirect accordingly.
When
I build and run this application, I am shown my basic Single Record Maintainer:

After
the form has been populate with data, I now see this.

Once
I click “Accept,” I am automatically redirected to this screen:

The
customer number that was entered by “Past Presidents” was automatically used to
redirect to the confirmation page created in Step 1.