How can I create an automation process to run both Static and Object methods in UiPath Studio

0 votes
How can I create an automation process to run both Static and Object methods in UiPath Studio?
Apr 9, 2019 in RPA by Hemant
2,028 views

1 answer to this question.

0 votes

Hello Hemant, you can create an automation process to run Static as well as Object methods using Java Activities package:

The Static Method:

  1. Open UiPath Studio and start a new Process.
  2. Drag a Java Scope activity to the Workflow Designer. Because no path is specified in the Java Library Path property, the Scope defaults to using the PATH environmental variable to initialize the Java Library.
  3. Drag a Load Jar activity to the Designer panel. Assign the path to the Objects.jar file in the JarPath property field.
  4. Drag an Invoke Java Method activity below the LoadJar. Input the method name in the MethodName property and then fill in the TargetType field with the Java package name and the class you want to use.
  5. Create a JavaObject variable, called JavaObjectResultStaticMethod, to store the values returned by the Invoke Java Method activity and place it into the Result property field.
  6. Add a Convert Java Object variable to the workflow and place the JavaObjectResultStaticMethod variable into the JavaObject property field. In the TypeArgument property field, select the System.Int32[] variable type.
  7. Create a new Int32[] variable, called ResultStaticMethod, and add it in the Result property field.
  8. Next, drag a For Each activity to the Designer panel.
  9. Set the TypeArgument property to Int32, and assign the ResultStaticMethod variable to the Values property field. This enables you to go through each integer of your array.
  10. Drag a Write Line activity into the Body of the For Each activity and assign value.ToString into its Text property. This helps you write all the values in the ResultStaticMethod variable in the Output panel, at runtime. 

The Object Method:

  1. Add a Create Java Object activity to the workflow, under the Java Scope activity used in the previous example.

  2. Use the name of the Java package and the Coordinate class to fill in the TargetType property - uipath.java.test.Coordinate.
  3. Create a variable in the Result property field by using the Ctrl+K hotkey and name it JavaObject.
  4. Drag an Invoke Java Method activity to the Designer panel.
  5. To get the sum of the data returned by the Coordinate class, write the getCoordinateSum method into the MethodName property.
  6. Create a variable in the Result property field by using the Ctrl+K hotkey and name it JavaObjectResultObjectMethod.
  7. Add the JavaObject variable in the TargetObject field.
  8. Add a Convert Java Object activity to the workflow.
  9. Add the JavaObjectResultObjectMethod variable in the JavaObject field.
  10. In the TypeArgument property drop-down, select the System.Double datatype.
  11. Create a new Double variable, called ObjectMethodResultValue, and add it to the Result property field.
  12. Drag a Message Box to the Designer panel.
  13. Assign ObjectMethodResultValue.ToString to the Text property to display the values inside the Double variable. At runtime, the JavaObject is created, containing the Coordinate class, then the getCoordinateSum method is run and its results are returned in another JavaObject. The results are then converted to a .NET Double variable which is then displayed in a MessageBox
answered Apr 9, 2019 by Pratibha
• 3,690 points

Related Questions In RPA

–1 vote
1 answer
0 votes
1 answer

Can I create dictionary in UiPath studio and add items to it?

Hey @Rumani, you can definitely create dictionary ...READ MORE

answered Mar 14, 2019 in RPA by Abha
• 28,140 points
16,856 views
0 votes
1 answer

How can I reuse an exisitng automation workflow in Uipath?

Hey Namita, for reusing existing workflows, you ...READ MORE

answered Mar 19, 2019 in RPA by Abha
• 28,140 points
3,583 views
0 votes
1 answer

How an agrument can be created and used in UiPath studio?

Hi @Piyush, to understand how an argument ...READ MORE

answered Mar 25, 2019 in RPA by Abha
• 28,140 points
3,746 views
0 votes
1 answer

What is Get Jobs activity used for in UiPath Studio?

Hey @Rakesh, Get Jobs Activity can be ...READ MORE

answered Mar 14, 2019 in RPA by Abha
• 28,140 points
3,116 views
0 votes
1 answer

How to format text in notepad using UiPath?

Hey @Rashmi, if you want to automate ...READ MORE

answered Mar 18, 2019 in RPA by Anvi
• 14,150 points
8,266 views
+2 votes
1 answer

How can I display current date in "dd-MMM-yy" format in UiPath Studio?

Hi Shilpa, if you want to display ...READ MORE

answered Mar 18, 2019 in RPA by Pratibha
• 3,690 points
17,257 views
0 votes
1 answer

How to check if a string exists in datatable using UiPath?

Hi @Ravi, to check whether a string ...READ MORE

answered Mar 19, 2019 in RPA by Anvi
• 14,150 points
17,897 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP