setSelection() in for multilist field

How to use setSelection() for a multilist attribute which already has some values. I try to use the below lines and it overwrites the existing values.

IAgileList values = (IAgileList)cell.getAvailableValues(); 
Object[] t = new Object[1]; 
t[0] = values.getChildren()[0]; 
values.setSelection(t);
cell.setValue(values);

Add Comment
4 Answer(s)

I’m not certain I understand what you are attempting to do.  Please explain what you are trying to accomplish and through what means.

Agile Angel Answered on July 18, 2015.

Items Page 2 has a field EBS Org which is change controlled . EBS Org already has values 101;102. When I try the above script on Event = Update Table to add value = 100 to the EBS Org field when the affected items table is updated , the EBS Org field gets updated with 100 but removes any existing values (101;102 in this case).

on July 20, 2015.
Add Comment

So to be straight I cannot help you but have clarified that the data would need to be appended rather than replaced so the command should ADD if rule = TRUE.

Perhaps some of our JAVA savvy folks can elaborate on how to addend data in a multi picklist on automation.

Agile Angel Answered on July 20, 2015.
Add Comment

Just found this in hopes that it may ring a bell…

“You have no other conditions like update this in all rows then you can try

UPDATE jos_content SET title = CONCAT('Mr. ', title) 

if you want to update conditionally that means particular row needs to update the you can use

 UPDATE jos_content SET title = CONCAT('Mr. ', title)  where fiedl_name ='condition'

eg: UPDATE jos_content SET title = CONCAT('Mr. ', title)  where id = '1'

this will update only one row which contain id=1.

any way before doing this should keep a backup”

Found at http://stackoverflow.com/questions/13358923/sql-query-to-append-prefix-to-existing-value-in-a-field

Agile Angel Answered on July 20, 2015.
Add Comment

Please try the below code :

String newValue = “100”;
String attributeValue = agileObj.getValue( “Page Two.attribute”).toString();
String [] strArr = attributeValue.split(“;”);
ArrayList <String> list = Arrays.asList(strArr);
list.add(newValue);

//Call this method 
//Cell is the Page Two Attribute Cell which you want to update
//ArrayList is the list which you get from the above lines of code

    public void appendValuesToMultiListCell(ICell cell, ArrayList<String> valuesList) {
            try {
                if(null!=valuesList && !valuesList.isEmpty()) {
                           int valuesListSize= valuesList.size();
                          String[] attributeValueArray= new String[valuesListSize];
                           for(int i=0; i<valuesListSize; i++) {
                                  attributeValueArray[i] = valuesList.get(i);
                           }
                           //Set the final list of values
                           IAgileList agileList = cell.getAvailableValues();
                           agileList.setSelection(attributeValueArray);
                           cell.setValue(agileList);
                     }
              } catch (Exception e) {
                   e.printStackTrace();
               
       }

Agile User Answered on July 29, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.