Code Stage To update Collection value

sck360

New Member
Hi,

Im trying to use a code stage to loop through a collection i have that contains one column. With each iteration the value in each row in will be updated.


So far i have an input collection in my code stage(input_collection) . This collection contains one column with 1000's of rows. These items are dates and need to be manipulated in some way with each loop. So far ive something like this:
//input_collection is input.
//Loop is set up to loop though each item in input_collection.

for (int j = 0; j < input_collection.Rows.Count; j++)
{
collection.Rows[j][0] = "New Date Example";
}


What i expected this code to do was loop through the entire collection and update each row(in this case to "New Date Example"), but having no luck so far.

Any help on this would be great appreciated

Thanks for help!!!
 
Last edited:

VJR

Well-Known Member
Hi sck360,

Did you mean input_collection here..

for (int j = 0; j < input_collection.Rows.Count; j++)
{
input_collection.Rows[j][0] = "New Date Example";
}

If that was a typo while submitting the post and still you are seeing the issue then...
Not sure how the rest of your code looks like. Try giving the column name and see although column number should also work-
input_collection.Rows[j]["ColumnName"] = "New Date Example";
 

sck360

New Member
Sorry for the confusion, this was just a typo.

Looks like i was forgetting to output the collection data at the end of the code stage.

Output_collection is referencing the same collection as input collection.

for (int j = 0; j < input_collection.Rows.Count; j++)
{
input_collection.Rows[j]["First_Detected"] = "Testing";
}

Output_collection = input_collection;

Thanks for the help
 
Top