Using the @OP tag to insert parameters

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 Developer’s Guide for information about grid rules, and using @OP tags in grid rules and with HTML.

NoteWhen you create an application with input parameters, you must define a default value to register as click-across event listeners.

StepsCreating a parameter using the @OP tag

  1. Log in to Mobile Web Studio.

  2. Select Applications in the left pane, and click the New button to launch Application Builder.

  3. In Application Builder, click the down arrow to the right of Add, and select Database Element.

  4. On the Database Element Definition window:

  5. On the Database Element Definition window, click Next.

  6. Use the Define window to identify record 1 as the header row. In the Define Record Layout section, click “Records contain labels,” accept the default 1 in the “Labels are displayed in Record” option, and click Next.

  7. On the Filter window, click Next to continue as this feature is not used in this tutorial. The Configure Parameters window displays with a list of parameters used to capture the table.

  8. On the Configure Parameters window:

  9. On Window Preview, in Element Name, enter CompanyAccount (no space), and click Finish. The New Web Element window closes.

  10. On the Application Builder window, the CompanyAccount element displays in the Element List. Click Save.

  11. On the Finish window, accept the defaults, and click Finish to save the application.

  12. Click OK to confirm.

  13. In Application Builder, the CompanyAccount application displays in the detail pane.

  14. 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.

  15. Click Close in the upper-right corner to close Application Builder.

  16. In Mobile Web Studio, approve the application:

  17. 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 Configure Parameters window when you create the application.

When you create an application with input parameters, you must define default values to register as click-across event listeners.