Get the value from SelectOneChoice or LOV not the index in bean -Oracle ADF

Another approach i am sharing with you.Normally we want to get selectOneChoice value and we normally get the index.
We will creating an attribute in the selectOneChoice items and the selected value lable.

                        <af:selectOneChoice value="#{bindings.reportType.inputValue}"
                                          required="#{bindings.reportType.hints.mandatory}"
                                          shortDesc="#{bindings.reportType.hints.tooltip}"
                                          id="soc1" partialTriggers="cb2"
                                          autoSubmit="true"
                                          styleClass="hrt_reporting"
                                          valueChangeListener="#{pageFlowScope.ReportFilterBean.reportTypeVC}"
                                          binding="#{pageFlowScope.ReportFilterBean.reportTypeChoice}">
                        <f:selectItems value="#{bindings.reportType.items}"
                                       id="si2"/>
                        <f:attribute name="rowIndexVal" value="#{bindings.reportType.items[bindings.reportType.inputValue].label}"/>
                      </af:selectOneChoice>

and in the bean you can write as

        valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
        Map map = ((UIComponent)valueChangeEvent.getSource()).getAttributes();
        String reportTypeValue = (String)map.get("rowIndexVal");

that’s it, you are done.

Happy coding with Vinay Kumar in techartifact,,

Get current row of table -Oracle ADF

Requirment- to get the current row of a table

Solution- Following is the code used for this

DCBindingContainer dcb = (DCBindingContainer)getBindings();    
DCIteratorBinding dcItr = dcb .findIteratorBinding("iteratorName");
RowSetIterator rsIter = dcItr .getRowSetIterator();
Row rowObj = rsIter .getCurrentRow();

Happy coding with Vinay Kumar in Techartifact 🙂

Get value of LOV/choiceList programmaticaly in bean instead of index in Oracle ADF

Requirment-Get value of LOV/choiceList programmaticaly in bean instead of index in Oracle ADF

When you wrote like In backing bean we get the index, not the value. most of the developer did this mistake.

JSFUtils.resolveExpression(“#{bindings.EmployeeId.inputValue}”); —- We got the index

Instead of use attributeValue to get the value in bean.use this code in the bean or as the EL

JSFUtils.resolveExpression(“#{bindings.EmployeeId.attributeValue}”);