This tutorial introduces you to the basic process of using the @OP tag to insert a parameter. At runtime, the parameter is replaced with the data that you specify. The @OP tag is often used in SQL queries, as it allows an application to use parameterized queries. You can also use the @OP tag for HTML fields.
See the Unwired Accelerator Feature Guide and the Enterprise Portal Development Guide for information about grid rules, and using @OP tags in grid rules, and with HTML.
When you create an application with input parameters,
you must define a default value to register as click-across event
listeners.
Creating a parameter using the @OP tag
Log in to Mobile Web Studio.
Select Applications in the left pane, and click the New button to launch Application Builder.
In Application Builder, click the down-arrow to the right of Add, and select Database Element. You see the Database Element Definition window.
On the Database Element Definition window:
Click the Connection Cache option.
Conn Cache name – select msales
from
the drop-down list.
SQL query string – enter select * from
account where name like '%@OP["CompanyName"="3Com"]%'
.
This @OP tag creates a parameter named CompanyName and sets its default value to 3Com.
When you create an application with input parameters,
you must define a default value to register as click-across event
listeners.
Click the Preview button to test the database connection and the SQL command.
Figure 2-4: Database element definition
On the Database Element Definition window, click Next in the top right section of the window.
In the Split window, click Next to continue as we will not use this feature in this tutorial.
Use the Define window to identify record 1 as the header row. In the Define Record Layout section:
Click “Records contain labels.” The “Labels are displayed in Record” option displays.
Accept the default 1
,
and click Next. The Filter window displays.
On the Filter window, click Next to continue as we will not use this feature in this tutorial. The parameter definition window displays with a list of parameters used to capture the table.
On the parameter definition window:
Click the Variable check box to the left of CompanyName. This exposes additional parameters.
Make sure the Default Value is set to 3Com
,
and click Next.
On Window Preview, enter CompanyAccount
(no
space).
Click Next.
On the Continuous Capture window, click Finish to complete the New Web Element window. Continuous Capture is not applicable to this tutorial. The New Web Element window closes.
On the Application Builder window, the CompanyAccount application displays in the Element List.
Click Save.
On the Finish window, make this entry (otherwise accept the defaults):
Click the Finish button to save the application.
Click OK to confirm.
In Application Builder, the CompanyAccount application displays in the detail pane.
In Company Name, enter part of a name of any other company
or companies in the sample msales database
and click Update. For example, enter tech
to
pull up all account records that have the string “tech” somewhere
in the name field. Other examples you can enter include store
, oak
, health
, auto
,
and corp
.
Click Close in the upper right corner to close Application Builder.
In Mobile Web Studio, approve the application:
Right-click the CompanyAccount application in the detail pane, and select Approval Status | Approved.
Click OK to confirm.
Select Approved from the Application Manager Status menu. You see the CompanyAccount application in the detail pane.
You can use multiple @OP tags simultaneously,
as shown in this example SQL query that uses two @OP tags
to perform a search based on a company name and a state.
select * from account where name
like
'%@OP["CompanyName"="3Com"]%'
and primaryAccountState
like '%@OP["State"="CA"]%'
If you use multiple @OP tags, additional parameters appear on the parameter definition window when you create the application.
Remember, when you create an application with input parameters, you must define default values to register as click-across event listeners.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |