SmartLinks allow you to easily link one application (Retrieval, Report, or Maintenance) to any other application, passing key data automatically. The benefits of this are many, including:
- You can create applications that allow users to drill from an order header table to order details records.
- View a list of products and maintain records based on the value you selected.
- Useful when making Dashboard Applications.
To create a SmartLink application, you will need (at least) two applications: The calling application and the receiving application. While it may seem backwards, you should always create the receiving application first, then create the calling application last.
- When your SmartLink calls the receiving application, it will examine what fields the receiving application is sequenced by. Only fields that are sequenced keys in the receiving application will be passed.
- Be sure to include Sequence keys that exist in both applications. If they have different names, be sure to set up a Synonym.
- If no matching fields can be found, no values will be passed along with your Smartlink.
- Compile your application, and make note of the application type and application number as we will use this information in our next step.
Next, let's build the calling application.
- Create or select an application that has one or more fields that match the sequence keys of the receiving application. The fields in the calling application do not need to be sequence keys, they simply need to exist.
- Click the SmartLinks button within Application Options, and click either Retrieval, Report, or Maintenance (this depends on the type of application you built in Step 1).
- Use the navigation options to find the application you made in Step 1. Click the green "Add" icon.
- Recompile your application and overwrite the HTML.
At runtime, your calling application will contain a link in the right-most column of your table (bottom-most if it is a Single Record template). Clicking on it will pass all of the values of the sequence keys of the receiving application where they existed in the calling application.
Note: You can use m-Painter to remove the generated link and replace it with a link on any value. Please consider this option by using the "Insert/Edit Link" button.
Selecting your Smartlink application from the 'Smartlinks' drop down will automatically build out the Smartlink URL for you. As a note, this slnk=1 parameter tells my retrieval that this page is a SmartLink. This means that the page will only show records that equal the value(s) you pass to it. Without specifying slnk=1, the page assumes a greater than or equal to (GE) relationship.
Real World Application
You wish to see Sales History Data in a Multiple-Record Retrieval. The problem is that the file contains millions of records and you know that you only ever want to see data for one particular customer at a time. You decide that you want to first show users a screen with all current customers. From here, the user should click on a customer, then they will be taken to all the Sales History data for that customer only.
- Build your Sales History Retrieval. You must sequence by the Customer Number. The reason you must do this is because m-Power will only pass data from key fields to an application. Build the retrieval.
- Next, build your Customer look-up retrival over your Customer Master table. Here the sequence key does not matter because this is the calling application. Simply be sure that the customer number has been included in this application.
- Add a SmartLink from the customer look-up to the Sales History application. m-Power will automatically know to pass the Customer # because that field is the key field in the receiving application. Compile the look-up.