Monday, 25 May 2015

How to Show/Hide/Restrict the Operators in adf:query Advanced mode

Dear All, Here I'll explain how to Restrict the Operators like starts with/ends with ... in ADF criteria Query VO.

The ADF Faces af:query component neatly binds to an ADF bc View criteria defined in the model. 


In the default advanced mode, the query panel allows end users to select a suitable operator to apply to the query fields. The default list of these operators (of type JboCompOper) is populated based on the field's data type and ADF is rather intelligent with this feature - for example:
a) for an LOV based field, it displays an LOV if you select the Equals operator but changes to a text field when you choose the Starts-with operator...
b) It shows you two fields if you select the between operator. 

In my case I'll show you the default Behavior Firstly.

                              



Now If Yo want to restrict the Operator then Go to particular VO select the Search Field and write the below code inside the <ViewAttribute> </ViewAttribute> tag.

<ViewAttribute

      Name="Ename"
      PrecisionRule="true"
      EntityAttrName="Ename"
      EntityUsage="EmpEO"
      AliasName="ENAME">
       <CompOper
          Name="Starts with"
          Oper="STARTSWITH"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0">
          </CompOper>
       <CompOper
          Name="Ends with"
          Oper="ENDSWITH"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0">
          </CompOper>
       <CompOper
          Name="Does not Contain"
          Oper="DOESNOTCONTAIN"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0">
          </CompOper>
       
        <CompOper
          Name="Less Than"
          Oper="&lt;"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0">
          </CompOper>
        <CompOper
          Name="Less Than Or Equal to"
          Oper="&lt;="
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Does not Equal"
          Oper="&lt;>"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Greater than"
          Oper=">"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Greater than or equal to"
          Oper=">="
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Between"
          Oper="BETWEEN"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Not Between"
          Oper="NOTBETWEEN"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Is Blank"
          Oper="ISBLANK"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
        <CompOper
          Name="Is Not Blank"
          Oper="ISNOTBLANK"
          ToDo="-1"
          MinCardinality="0"
          MaxCardinality="0"></CompOper>
    </ViewAttribute>


Here I am restricting the operators for EmpName field.
After Using this code you will find the below Output.

                                   




So this is the small code Which you need to change, Thanks All.


No comments:

Eclipse With Python

Hi Guys, Today i'll share how to start python project in eclipse IDE. to start Py development in eclipse we need to add Py Dev plugi...