How to add variable to a existing datatable


#1

Hello,

I have a dataTable with few missing column information for e.g as below:

ColumnA ColumnB ColumC
Value1 Blank Value2

Now I have to add value in columnB which is a variable value getting from other source.

I am trying using ‘Assign’ activity as ‘‘dataTable.rows(0).item(1) = myvariable’’ but this is throwing an error stated :- “Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value(not initialized”.

Please advise


#2

Hello!

The Datatable is already fulfilled with information before you’re adding this new value?

Have you tried to run the Datatable through a For Each Row Activity, then use the assign with “Row.item(“Column”) = myVariable” ?

Regards,


#3

No actually Column B is blank, there is no information and I have to add info there.


#4

Also, I have tried row.item(“columnName”) = my variable inside for each row activity but giving me the same error… Please suggest


#5

hey @rk.sati

I don’t know what is going wrong at your end…:wink:

please find the attached sample for you and let me know… if still their is doubt … :slight_smile:

Datatable col_val_assignment sample.xaml (8.1 KB)

Regards…!!
Aksh


#6

Thank you Aks!

But I am not able to download the xaml file. When I am clicking it to download, it is routing me to different page with contents as below:

‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’

<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments=“x:String”>
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Drawing</x:String>
<x:String>System.IO</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>System.Xml.Serialization</x:String>
</sco:Collection>

‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’'
Please suggest if you have any idea or may this is my system issue.


#7

Hey @rk.sati

This has been addressed in many posts :slight_smile:

just right click on the attachment and Save As and rename it as per your convention :slight_smile:

Regards…!!
Aksh


Trying to download the examples RPA but i stuck with with the page of that code and do not know where is the issue why its not loading as before