Showing posts with label ROW. Show all posts
Showing posts with label ROW. Show all posts

Wednesday 6 December 2017

Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'row' resolved to null


When we are working with table there are some cases we face the following error:

by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'row' resolved to null


As per my findings, this issue will occur when we are working with LOVs in the table or with the QBE.

Working with LOVs:
   Is primary is part of the LOV then you can face this issue. To fix this issue then the suggested solution is to create surrogate key.

QBE:
   If you face this issue when you try to enable QBE, then make sure that you are not referring to the row in filter facets in the table columns.

By default QBE shows input textbox for all the columns, if you want to show different component like date component or LOV then Filter facets are used to render the different component when QBE is enabled.

  <f:facet name="filter">
     <af:selectOneChoice label="Access Mode" id="soc2" value="#{vs.filterCriteria.AccessMode}" simple="true">
         <af:selectItem label="#{null}" id="si4" value="#{null}"/>
         <af:selectItem label="Public" id="si5" value="1"/>
         <af:selectItem label="Private" id="si6" value="0"/>
     </af:selectOneChoice>
  </f:facet>

If you facing 'Target Unreachable, identifier 'row' resolved to null' issue with QBE then you have to make sure that you are referring to row attribute in the filter facet.
Ex:
<af:selectOneChoice label="Access Mode" id="soc2" value="#{row.bindings.pfscopeBean.AccessMode}" simple="true">

It should refer with the varstatus property like
 <af:selectOneChoice label="Access Mode" id="soc2" value="#{vs.filterCriteria.AccessMode}" simple="true">


Note:
Table definition in the jsff will be like:
<af:table value="#{bindings.myVO1.collectionModel}"
     var="row"
     rows="#{bindings.myVO1.rangeSize}"
     varstatus="vs"
.......
</af:table>

If above suggestion will not work try is by setting changeEventPolisy=ppr for the detail table iterator and the tree binding in the pageDef file

Monday 29 June 2015

How to know whether current row is new row or from database?

A row or view has four states:
  • New
  • Modified
  • Un-Modified
  • Initialized
To get the state using expression: #{row.row.entities[0].entityState}

You can use this expression to control the display or rows in the UI. Like to display new rows in diff colors.
    Ex: #{row.row.entities[0].entityState==0 ? 'background-color:yellow' :  ''} 
Now in RowImpl, you can access the state using:
    Ex: byte entityState = this.getEntity(0).getEntityState() 

Friday 23 January 2015

How to filter rows in VO

There are different ways to filter the data/rows in a VO.

1. Using Where clause:
  You can use setWhereCluse() method from VO to set filter constraint before calling executeQuery() method to filter data based on the input condition. This means we are appending the where clause while querying the data to the DB. This will take string as in input.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
   //filtering data using  setWhereClause on employee_id
   empVO.setWhereClause("employee_id=" + empId);
   empVO.executeQuery();
 


Note: Here employee_id is the column name from the db table.

 You can have multiple constraints in where clause just like in sql.
 emp.setWhereClause("employee_id=" + empId + "employee_name like " + empName);

2. Using getFilteredRows(): getFilteredRows() is from VO, this method is used to filter rows based on one column only and returns Row[]. getFilteredRows() returns the Row[] by filtering the rows from VO cache based on the column attribute passed.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
    //filtering data using  setWhereClause on employee_id
    empVO.executeQuery();
    Row[] rows = empV.getFilteredRows("EmployeeId", empId);


Note: EmployeeId is the attribute name from VO.


3. Using Row Qualifier: Using RowQualifier you can filter the data based on multiple columns from VO cache.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
    //Create RowQualifier from VO 
    RowQualifier rowQualifier = new RowQualifier(empVO);
    //set where clause to row qualifier 
    rowQualifier.setWhereClause("EmployeeId="+empId+" AND EmployeeName="+empName);
    //get filtered rows using row qualifier 
    Row[] filteredRows = emp.getFilteredRows(rowQualifier);  

Note: EmployeeId & EmployeeName are the attribute names from VO.