Use of Invoke Method

Try replicating my code in above image, or please attach your code.

Hi,

I just found the problem If we use Build Data table after creating the new instantiation
Dt=new DataTable(“Kitti”);
and then if we print
ds.tables(0).tablename.tostring()-- Output —> TableName
otherwise its printing properly. Why is this happening???

Please add a reproduction workflow - it will make it easier for all to debug and see if it’s something wrong with the way you used the code or is there an actual bug.

Preferably include there a sample that works and the one that doesn’t - usually you’ll see what’s going on when doing those anyway.

Regards.

1 Like

brilliant explanation.

Hi @vvaidya/ @aksh1yadav ,

I’m reading a excel and storing the data in the datatable.
Now i need to delete a column from the datatable using invoke method.
How can i do it ? Please help me.
dbReport is the table name.

Thanks,
Hemanth.

Hey @Hemanth_Gali

Please visit this link:

Regards…!!
Aksh

thank you for your reply @aksh1yadav , but my requirement is to delete column.:neutral_face:

Sorry, in hurry did not read your question well.
Check the Edited Post of mine. @Hemanth_Gali

REgards…!!
Aksh

1 Like

Hi Team,

Invoke method implementation is quite simple, this is used when we try to implement something beyond our builtin activities. You can use this activity to invoke a method of a Nonstatic or Static class.

Steps for invoke Method implementation:

Example using Static Class
1 Create a .net Class Library project.
2. Create a non_static class having a non static method on it.
(Make sure that you have added the required namespace: System.Activities.presentation.Metadata and System.ComponentModel)
image
3 Build the project in release mode.
4 Create a nuget package and save to the the activities location in your system"UiPath\app-17.1.6522".
5 install the nuget package to the UiPath Project.
Target Type: If the class is non ststic then keep the Target type as null.
Target Object: Create a instance of the class.ex new ClassLibrary1.Validate
Method Name: Provide the method name, ex ValidateString
Pass the result to a variable, ex result
Task is complete
image
With Static Method
image

TargetType Target Type must be the class instance.

image

Thanks,
Asish

10 Likes

Cool! That’s exactly what I want!

But I am confused with two points:

4 Create a nuget package and save to the the activities location in your system"UiPath\app-17.1.6522".
5 install the nuget package to the UiPath Project

How can I create a Nugget Package?

And more important, How can I Install a nugget Package in UIPath Project?

Please read this post to create a Nuget Package.

Hii
How i can move that folder which contains both json and image files from one directory to another directory? In Uipath
Please help me regarding this issues. Need workflow for this .

Get the files count from the directory (json and image ) and then use move file activity to move to another directory in a loop
or use .net method
Directory.Move(sourceDirectory, destinationDirectory);

Thank You
Can u please provide workflow.

Main.xaml (10.0 KB)

Please check this

2 Likes

Thank’s for this,
But it only copy all the folders to another folder. I want to copy the folder which contains json and image files.

I was struggling how to use InvokeMethod activity to invoke Array.Resize method.
It always failed with error:

‘Array’ does not have a public static method named ‘Resize’ matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod ‘Invoke Method - Array Resize’.

Finally I learned that Array.Resize is a generic static method which require besides Parameters also define GenericTypeArguments

Below picture illustrates the set-up of InvokeMethod for invoking generic static method.

image

Cheers

4 Likes

Hey,

Hope you will find this article helpful :slight_smile:

Regards,
Sharath Raju

4 Likes

I read article. very helpful. thanks

Hi,

I have read the article, but i’m still confused about how can i find these methods and what are they and what function can these methods do.

Do you know that?
Thanks in advance.