1
0
-1

Hi,

I'm coding a Bean Shell action for a datalist

I'm trying to differentiate the action based on the value of column "Activité".

 

I understand that the Bean Shell action is fed with "rowKeys" which are the primary Keys of the selected rows. How do I get the "Activité" value of the selected rows?

Thanks a lot

Baptiste

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi,

      I used that solution already, but I thought there would be a more convenient way to do it.

      What i did: (keys and dataList) are variables fed by the system when clicking on a Datalist Bean Shell action.

      Keys are the primary keys of the selected items

      datalist is the whole datalist (of selected AND unselected items)

      public void completeSubculture(String[] keys, DataList dataList) {
      	DataListService dataListService = (DataListService) AppUtil.getApplicationContext().getBean("dataListService");
      	String sql = "";
      	Connection con = null;
      	DataListCollection rows = dataList.getRows();
      
      	for (String key : keys) {
      		String activityName = "";
      		for (int i = 0; i < rows.size(); i++) {
      			if (key.equals(dataListService.evaluateColumnValueFromRow(rows.get(i),"id"))){
      				activityName = dataListService.evaluateColumnValueFromRow(rows.get(i),"activityName");
      				System.out.println(activityName);
      			}
      		}
      	}
      }


      What i find fastidious is that the only way of retrieving a row is by comparing primary keys.

      But it works so... great!

      Cheers


      Baptiste

        CommentAdd your comment...