Getting 60018 Invalid Parameter error while trying to populate multilist in v9.3.6
Hi
I am relatively new to Agile PLM Sdk.
When trying out a case where a multilist value has to be updated from a parent item to its BOM children (using SDK in v9.3.6) getting 60018 Invalid Parameter at the setselection method. Saw similar issues in the forum. Tried those resolutions also but still getting the same error.
Code is as follows:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import com.agile.api.*;
public class TestPopulateMultilistinBom {
public static IAgileSession session;
public static AgileSessionFactory factory;
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
session = connect(session);
readSimpleList();
} catch (APIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void readSimpleList() throws APIException {
// TODO Auto-generated method stub
IItem pitem = (IItem) session.getObject(ItemConstants.CLASS_PART, “P00049”);
String parentvalues = getvalues(pitem);
setValues(pitem,parentvalues);
}
public static void setValues(IItem citem,String pvalues) throws APIException{
ITable items = citem.getTable(ItemConstants.TABLE_BOM);
Iterator rows = items.iterator();
IRow bomRow;
while(rows.hasNext()) {
bomRow = (IRow) rows.next();
IItem bItem = (IItem) bomRow.getReferent();
System.out.println(“Item ” + bItem.getName());
ITable bomPageTwoTable = bItem.getTable(ItemConstants.TABLE_PAGETWO);
Iterator bomPageTwoit = bomPageTwoTable.iterator();
IRow bomPageTwoRow = (IRow)bomPageTwoit.next();
ICell bomCell = bomPageTwoRow.getCell(ItemConstants.ATT_PAGE_TWO_MULTILIST02);
System.out.println(“bomCell name ” + bomCell.getName());
IAgileList bomCellvalues = bomCell.getAvailableValues();
List<String> a1 = new ArrayList<String>();
a1 = Arrays.asList(pvalues);
int ctr=0;
for(String s: a1){
System.out.println(“array ” + s + ctr);
ctr++;
}
String[] arrOfStr = pvalues.split(“;”);
ArrayList<String> supplierlist = new ArrayList<String>();
for (String temp : arrOfStr) {
supplierlist.add(temp);
}
for (String a : arrOfStr)
System.out.println(a);
bomCellvalues.setSelection(supplierlist.toArray());
bomCell.setValue(bomCellvalues);
IAgileList bomfield = (IAgileList) bomCell.getValue();
System.out.println(“bomfield ” + bomfield);
}
}
public static String getvalues(IItem item) throws APIException{
ITable table = item.getTable(ItemConstants.TABLE_PAGETWO);
System.out.println(“Size ” + table.size());
Iterator it = table.iterator();
IRow row = (IRow)it.next();
ICell cell = row.getCell(ItemConstants.ATT_PAGE_TWO_MULTILIST02);
IAgileList list1 = (IAgileList) cell.getValue();
String liststring = list1.toString();
return liststring;
}
private static IAgileSession connect(IAgileSession session2) throws APIException {
// TODO Auto-generated method stub
factory = AgileSessionFactory.getInstance(“http://LAPTOP-CAPUTM8U:7001/Agile”);
HashMap params = new HashMap();
params.put(AgileSessionFactory.USERNAME, “admin”);
params.put(AgileSessionFactory.PASSWORD, “agile936”);
session = factory.createSession(params);
// System.out.println(“session ” + session);
return session;
}
}
******
Error stacktrace is as follows:
Size 1
Item P00046
bomCell name Page Two.Supplier Access
array Admin;Store user0
Admin
Store user
Error code : 60018
Error message : Invalid parameter.
at com.agile.api.pc.Session.createError(Session.java:2039)
at com.agile.api.pc.APIObject.createError(APIObject.java:76)
at com.agile.api.pc.CascadeList.setSelection(CascadeList.java:1567)
at TestPopulateMultilistinBom.setValues(TestPopulateMultilistinBom.java:117)
at TestPopulateMultilistinBom.readSimpleList(TestPopulateMultilistinBom.java:43)
at TestPopulateMultilistinBom.main(TestPopulateMultilistinBom.java:26
Can anyone let me know what I might be missing ?
Thanks
Sabarish