send unique records from one container to another container

hi,

Actually i have two containers con1 & con2. container con1 having duplicate records.i need to send the unique records from con1 to con2.how can i send these records.

Please any one help me

Hiii Kola,

use this method in job …i think its very good example to understand easily…

static void Contaner(Args _args)

{

container c1 = [1,2,2,3,4,5,6,6,7,7,8];

container c2;

Set set = new set(Types::Integer);

SetEnumerator se;

int i;

;

// Load the containre into the set

for (i=1; i<=conlen(c1); i++)

set.add(conpeek(c1, i));

// Get the enumerator for traversal

se = set.getEnumerator();

// Unload the set back into the c2 container

while (se.moveNext())

c2 += se.current();

// Output the container

info(strfmt("%1", con2str(c2)));

}

Thank & Regards

Nitesh Gangrade

Thank you very much nitesh.it is working

Hi,

U can do like this…

static void Container2container(Args _args)
{
container c = [1,2,3,4,1,5,2,6];
int i;
int j;
int l, m;
container c1;
int p = 0;
;

//info(conpeek(c,1));
c1 = connull();
for(i=1; i <= conlen(c); i++)
{
l = conpeek(c,i);
for(j = 1; j <= conlen(c); j++)
{
if(i != j || i == conlen(c))
{
if(i != j)
{
m = conpeek(c,j);
}
if(m != l)
{
if(j == conlen(c))
{
p++;
conins(c,p,l);
info(strfmt(“At %1 Position Value is %2”,p,l));
break;
}
else
{
continue;
}
}
else
{
break;
}
}
else
{
continue;
}
}
}
}