Author Message
Anonymous

I am porting an old IR app to OD that uses a deprecated 'setCollection' call. Can you tell me exactly what 'setCollection' used to do so that I replicate it properly?

Here is the code:
IVariable var = mySession.getVariable(IProjectVariables.THE_VAR);
var.setCollection(new ComplexCollection(var.getComplexVariable(),IProjectVariables.THE_VAR));

I want to make sure I properly handle the cases where var has values, or is already a collection with multiple values. Since the old forums disappeared, I could not tell exactly what 'setCollection' did.

Thanks!
Derek
NeilGoldsmith
Joined: Nov 6, 2013
Messages: 902
Offline
setCollection would place a collection onto a variable so that you could store multiple values on it.

Use addCollection() which will create the collection for you.

Please login or create a login if you haven't already so you don't post anonymous.
Anonymous

Right, but what does setCollection do if there is already a collection on the var? Does it leave the collection alone? I wasn't sure if it removed any existing data or not.
NeilGoldsmith
Joined: Nov 6, 2013
Messages: 902
Offline
You will lose the old collection with a new call to either setCollection or addCollection.
Go to:   
Mobile view