Configuring a Host Session at Run Time
When you create your application, you create a design-time host connection with configuration information that is also used for the run-time session. If you need to configure the session with information that is only available at run time (for example, the user name or the IP address of the client computer), you can use a Configure action, and then a Connect action, within an event.
This is typically done in the On Startup event, but you can add these actions to any event in your application.
|To configure the host session at run time
- Open your project in Presentation Designer.
- Create or modify an event.
|Edit the start up event (only client runtime environment variables will be available to use for configuration)
- From the Edit menu, choose Project Properties.
- In the Project Properties dialog box, under Project, choose Startup/Stop.
- Click the Edit Application Startup button.
The Event editor displays showing the ApplicationStartup event.
|Add an event within your application (any eligible data from your application will be available to use for configuration)
- In the Event editor, from the Actions List, click the Session button.
The Session actions appear from the Actions list.
- Add a Configure action to the event.
If you are editing the ApplicationStartup event, add the Configure action before (above) the Connect action.
- Under Configure, from the Select a Host to Configure list box, select the host to which you want to connect.
You must have already made a design-time connection to the host before it will appear in this list. To learn how to create a design-time host connection, see Connecting to a Host, Overview
- Click the Assign Host Properties button.
The Assign Host Properties dialog box appears, showing the eligible data on the left, and the configurable host properties on the right.
- Assign a data element from the list on the left into the host property that you want to configure on the right, and then click the Add Mapping button.
Create a constant (right-click an operation input and choose Map Constant), and type any value to map to the input.
- If you are editing the start up event, only the client run-time environment variables (IP Address and User Name) will be available to use for configuration. If you are adding an event within your application, the client run-time environment variables, any previously defined global variables, plus any eligible data from the current form and host screen will be available to use for configuration. To use data from a different part of your application, first assign it to a global variable.
- You can select an input and click the Properties button at the bottom of the window to learn more about it.
- Click OK.
- If you are editing the startup event, click OK to close the Event editor.
If you are adding an event within your application, add a Connect action after (below) the Configure action, select the same host as the one you've just configured, and select the expected start screen, and then click OK to close the Event editor.