Two.5 Questions both relating to Datatables and making updates (hopefully) without For Each Loop

Two.5 questions being asked here. The basis is an existing data table that is destined to be bulk loaded into queue up in Orchestrator. The questions are:

  1. I have a column where the values are “88888888-###”. Basically 8 digits followed by “-” and then some other number of digits. Without a For Each, how can I take that column’s value and remove the “-” and all following text from the string and push that back into the same column value.
    2.5) Or … possibly take the value without the “-###” portion of the string and push that into a new column in the datatable.

  2. Add a Reference Column - My question isn’t how to add the column itself. Plenty of examples on that. My question is how to add it and automagically fill in the reference values. Say using values generated using Guid.NewGuid().toString or something similar … without using a For Each loop. Not sure I’m going to keep the Reference column and the Unique Ref setting on the queue. Stilling working out the queue logic for the queue drainer flow.

1 Like

Use the string.replace("-","")



Maybe this could be achieved using a LINQ expression.

This may help you


Hope this expression would help you resolve this
datatable = datatable.Asenumerable().Select(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Replace("-###","")).CopyToDatatable()

Cheers @soneill437

1 Like

Thanks for the reply. I’ll mess around with that.

Your reply really points me to knowing I need to learn about enumerable and where queries. I’ve hacked a few into my workflow and they work but I don’t understand why. Time to do some Googling.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.