Monday 22 February 2016

Hide custom operators from af:query panel in advanced mode : ADF(12.2.1)

Hi,

Recently I got requirement to hide custom operators(un-necessary) from criteria item in advanced mode.

In 12.2.1, You can achieve this through wizard.

Step1: Edit View criteria by clicking Edit button

Step2; Select criteria item from View criteria

Step3: Click on Custom operators button and remove un-necessary operators


But what if it is not part of view criteria,

in above case you still achieve like the way we used to do in 11g by using
<CompOper>

To make our life easier,
1) first add attribute to view criteria,
2)remove unnecessary operators form custom operators
3)Go to source mode, copy CompOper from view criteria item and put it some where for reference
4)remove the attribute from view criteria
5)Go to source mode, find the attribute then copy the CompOper properties which you copied in step3


Then go to source mode and then find out the attribute for which you want to restrict the operators then use <CompOper>
for Ex, In below example, I have restricted all the operators except equals for string attribute

<ViewAttribute
    Name="Status"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="1"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="STATUS"
    Expression="STATUS"
    SQLType="VARCHAR"
    LOVName="LOV_Status">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="1"/>
    </DesignTime>
    <CompOper
      Name="Status_Oper"
      ToDo="-1"
      Oper="&lt;"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper1"
      ToDo="-1"
      Oper="&lt;="
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper2"
      ToDo="-1"
      Oper="&lt;>"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper3"
      ToDo="-1"
      Oper=">"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper4"
      ToDo="-1"
      Oper=">="
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper5"
      ToDo="-1"
      Oper="BETWEEN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper6"
      ToDo="-1"
      Oper="CONTAINS"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper7"
      ToDo="-1"
      Oper="DOESNOTCONTAIN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper8"
      ToDo="-1"
      Oper="ENDSWITH"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper9"
      ToDo="-1"
      Oper="ISBLANK"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper10"
      ToDo="-1"
      Oper="ISNOTBLANK"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper11"
      ToDo="-1"
      Oper="NOTBETWEEN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper12"
      ToDo="-1"
      Oper="STARTSWITH"
      MinCardinality="1"
      MaxCardinality="1"/>
    <Properties>
      <SchemaBasedProperties>
        <CONTROLTYPE
          Value="choice"/>
      </SchemaBasedProperties>
    </Properties>
  </ViewAttribute>



For detailed information, please refer Jobinesh blog

http://www.jobinesh.com/2012/06/hiding-unwanted-operators-in-advanced.html