Monday, January 23, 2012

Key Sample: How to find row from viewobject based on key attribute

DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeeIterator");
Key k1 = new Key(new Object[]{100}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
for(Row r: r1){
System.out.println(r.getAttribute(0)+" "+r.getAttribute(1));
}

TaskFlow as Popup Window

TaskFlow in Popup

You can run a taskflow like a popup window and also return value:
Two things to be taken care of 1) Create a bounded task flow (one which will be displayed in popup). In properties window for this taskflow, in behaviour tab set run as Dialog property to true and display type as inline popup. 2) The button, on click of which this should appear as popup. Select the button and in property window set below properties: - Use window : true - Window Height: 300 - Window Width:300 You can also set parameters as under. 1)In 1st taskflow definition drag and drop the taskflow which you want to run like a popup window
2) select that taskflow and in properties panel in return parameter you can specify a parameter, if you plan to return something
- In behaviour tab set Run as Dialog property to True & display type default(external window)

and then you can set pageflow scope varible to return value from here for selected record.
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("parameter", value);

AutoSuggest TextField (InputText Field).


AutoSuggest Behaviour on Text Fields

1) In ViewObjext definition create a new attribute (transient attribute, because autosuggest will work on the description / id lov for e.g. if you define the lov on any id field and you are displaying description / name as label then in that case the sorting will happen on ids and not on descripti

on).
To avoid this problem define transient attribute, name it accordingly and in lov Configuration Select that id attribute (employee id) as well as description, so what will happen is based on the description selected corresponding id will also be selected).

In UI Hints you can select the name/descirption field to display and List Type should be InputText with List of Values.

2) Now on you JSF page, lets say that you have dragged and dropped this viewobjects datacontrol as table and for this field you select it as textfild(default will be combo etc).
Add this code for you field

e.g.




Once you drag and drop view as table then the tree node is created in table and this expressions will work.

findRowByIteratorAttribute - Find a row within Iterator with some attribute value

Once we get hold of iterator and when we need to find a row in iterator based on any attribute value, we can use below code

String lName = "Joe";
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeesIterator");
RowIterator rIter= iter.findRowsByAttributeValue("LastName", true, lName);
String empId = rIter.first().getAttribute("AcctId").toString();

Sunday, January 22, 2012

Setting PageFlowScope Parameters from Button ActionListener withoout code

1) When we want to set pageflowscope parameters without writing code

- Attach SetActionListener Operation to button




The EmployeeId is defined against employee id attribute against employee iterator on pagedefinition.

We can have n number of the variables defined here to pass pageflow scope variables.