Substitution Expressions for User-Specified Values
When information must be specified by a user rather than by the designer of a task, the substitution expressions that access the @FORM context group makes this information available within a webject even though the exact value is not known at the time the template or task is being designed.
You can use substitution expressions in any data attribute value on a param tag.
To specify one parameter value as input by a user in a web-based form or on a URL, the parameter value can be similar to the following:
data="$(@FORM[]variable[])"
You use @FORM[] in these formats because there is only one element in the @FORM context group. The empty value selector, [], for the form variable is used because there is only one value equated to the variable.
To specify multiple parameter values as input, you include the asterisk (*) as the value selector. To format multiple parameter values correctly, you must also include the delim attribute to identify the comma as the separator in the string that is substituted. For multiple values, the parameter value can be similar to the following:
data="$(@FORM[]variable[*])" delim=","
The asterisk in the value selector, [*], selects all values and concatenates them together into a string using the comma as a separator. The delim attribute tells the webject that multiple values in the data attribute are separated by a comma.
|
If the form you use includes an INPUT element that has a control type of file select for selecting files to upload, all of the form variables you want to use in parameter substitution must be set on the form before the INPUT element. For more information, see Uploading and Downloading BLOBs.
|
Example: Display-Object Substitution Using @FORM
The following variables set up the table format and attributes that are visible to the user. The values for the variables are available in the @FORM context group and can be retrieved from this group.
border=2
att=ename
att=phone
headers=Name
headers=Telephone
Also assume that the following Display-Object webject resides in an Info*Engine JSP page and displays an employee list using the variables from the form:
<ie:task uri="listemployees"/>
<ie:webject name="Display-Object" type="DSP">
<ie:param name="BORDER" data=$(@FORM[]border[])/>
<ie:param name="ATTRIBUTE" data=$(@FORM[]att[*]) delim=","
default="*"/>
<ie:param name="HEADER" data=$(@FORM[]headers[*]) delim=","/>
</ie:webject>
After substitution processing by Info*Engine, the parameters in the webject are as follows:
<ie:webject name="Display-Object" type="DSP">
<ie:param name="BORDER" data="2"/>
<ie:param name="ATTRIBUTE" data="ename,phone" delim=","
default="*"/>
<ie:param name="HEADER" data="Name,Telephone" delim=","/>
</ie:webject>
Example: Query-Objects Substitution Using @FORM
Assume that the following URL has been submitted to “webServer1”:
http://webServer1/Windchill/servlet/IE/tasks/QueryObject.xml?CLS=EMPLOYEES&ATTS=
NAME&ATTS =EMPNO&ATTS=SALARY&WHR=NAME='&SMITH'
Then, the @FORM context group contains the following variables:
CLS=EMPLOYEES
ATTS=NAME
ATTS=EMPNO
ATTS=SALARY
WHR=NAME='&SMITH'
Also assume that the following Query-Objects webject resides in the QueryObject.xml task and queries the information system connected to the “jdbc” adapter using the variables from the URL:
<ie:webject name="Query-Objects" type="ACT">
<ie:param name="INSTANCE" data="jdbc"/>
<ie:param name="ATTRIBUTE" data="$(@FORM[]ATTS[*])" delim=","
default="*"/>
<ie:param name="CLASS" data="$(@FORM[]CLS[0])" default="EMP"/>
<ie:param name="WHERE" data="$(@FORM[]WHR[0])" default="()"/>
<ie:param name="GROUP_OUT" data="queryStatus"/>
</ie:webject>
After substitution processing by Info*Engine, the parameters in the webject are as follows:
<ie:webject name="Query-Objects" type="ACT">
<ie:param name="INSTANCE" data="jdbc"/>
<ie:param name="ATTRIBUTE" data="NAME,EMPNO,SALARY" delim=","
default="*"/>
<ie:param name="CLASS" data="EMPLOYEES" default="EMP"/>
<ie:param name="WHERE" data="NAME='&SMITH'" default="()"/>
<ie:param name="GROUP_OUT" data="queryStatus"/>
</ie:webject>
After all processing is completed by Info*Engine, the parameters in the webject are as follows:
<ie:webject name="Query-Objects" type="ACT">
<ie:param name="INSTANCE" data="jdbc"/>
<ie:param name="ATTRIBUTE" data="NAME"/>
<ie:param name="ATTRIBUTE" data="EMPNO"/>
<ie:param name="ATTRIBUTE" data="SALARY"/>
<ie:param name="CLASS" data="EMPLOYEES"/>
<ie:param name="WHERE" data="NAME='&SMITH'"/>
<ie:param name="GROUP_OUT" data="queryStatus"/>
</ie:webject>