Parameters and filters

Unwired Accelerator applications can have parameters to retrieve dynamic content and use filters to retrieve only the records that are of interest if the application contains grid/structured data.

The explicit word for parameter is “parameter.” If your application has more than one parameter, you need to specify the parameter display name or the display name’s synonyms for each; for example, “find cars with make Acura and color blue.”

The explicit word for filter is “filter.” If you use the explicit word for filtering, the default field name (column name) defined in the application will be used to apply the record filter. Otherwise, you can specify the field name or its synonyms and the value to filter out unwanted records. If the fields are assigned in the application, the field names can be used to identify the application. If that is the case, Unwired Accelerator will only return that field’s content in the structured data.


Handling date queries

UA 8.0 allows you to specify dates as parameter values. For example, get exchange rates for today. In this example, today is converted to a date value, which is passed into the parameter for display name. For each parameter that is a date type, you must select the Calendar Date as the Display Type.

Date formats vary depending on the backend data source. You can select a JSP template for each parameter–the result of the JSP template is the value for the parameter. UA provides three default JSP templates:

If you want a different date format for the parameter, for example mmm to represent the month as Jul, or, Aug,or Jun, etc., then you must create your own JSP template. You can define the template in the Advanced Parameters window by clicking the Advanced button on the Configure Parameters window. See “Assigning JSP templates”.

If you want to query in the format Jun 2005, then you must write a JSP template that takes the input in that form. See “Creating application input fields”.

To create a JSP template that takes input in mmmyyyy form:

  1. Create a JSP template called UTCtoMMMYYYY.jsp. Here is an example of the JSP code:

    <%@ page language="java" %>
    <%@ page import="java.util.Hashtable" %>
    <%@ page import="java.util.Enumeration" %>
    <%@ page import="java.util.Date" %>
    <%@ page import="java.text.*" %><%
       String value (String)request.getAttribute("RequestParamValue");
       try
       {
         if (value.length()>2)
       {
         Long stime = new Long (value);
         Date d = new Date(stime.longValue());
         out.println("Date is " + d);
         SimpleDateFormat sdf = new SimpleDateFormat ("MMM yyyy");
         value = sdf.format (d);
         out.println("Value is " + value);
       }
       }
         catch (Exception e) {
         out.println("Error in conversion !! " + e.getMessage());
         e.printStackTrace();
       }
         request.setAttribute("RequestParamValue", value);
    %>
    
  2. Save the file in %SYBASE%\tomcat\webapps\onepage\portlets\templates\mobile if you are using Tomcat .

  3. In Application Builder, click Params to launch the Configure Parameters window.

  4. Click Next.

  5. In the Configure Parameters window, click Advanced. In the Advanced window, click Find next to the parameter you want to assign the JSP template to.

  6. In the Find JSP Template window, click Search.

  7. In the Results pane, select the UTCtoMMMYYYY template and click OK.

  8. Save the application.