Invoke Code between two seperate sequences with Stopwatch Function

Hello Community,

i’m trying to make my own Activities in UiPath-Studio. Currently i want to make a few, which contains the Functions of the Variabletyp ‘StopWatch’.

One Activity should only start and the another one stop the stopwatch. Nothing more.

I created two Sequences in a Project: Timer Start.xaml and Timer Stop.xaml.

Timer Start.xaml currently looks like this:

Timer Stop.xaml currently looks like this:

I know this is wrong. But i have tried before with the Invoke Workflow File and Arguments in the Timer Stop.xaml. It didn’t worked. The error Message is: Timer Stop: A call target has caused an exception.

And now i am very desperated witch that Situation. I have no more ideas and need help.

I think the problem is, that i can’t get the instantiated variable? Am i right? If so, can the variable stopwatch in Timer start.xaml however transferred to Timer stop.xaml? Or is that generally not possible?

Thanks in advance for feedbacks and answers.
Regards

1 Like

Hi

If the second workflow is invoked then we can pass the value from first workflow to the second with ARGUMENTS

Say for example you have two workflows A and B
Both are created in same project

Now you have Timer start in workflow A
Here create variable in the variable panel and assign the value to that variable which you want to pass it to next workflow B

Now in workflow B you have the Timer stop set of activities
Here create a argument in argument panel with IN direction

Then getting back to workflow A, use a INVOKE WORKFLOW FILE activity and call the workflow B
Click on Import arguments and it will import the created IN argument
Then mention the variable we have created in workflow A

This will pass the value from workflow A to workflow B through the argument created

Cheers @kibar.albayoglu

Hello Paniyappan,

thank you very much for your post and help.

Exactly, i have two workflows A and B in one Project. But i didn’t understand you how to pass it.

I have done what you said before, but it didn’t work after all. Same error Message.

Here is my Workflow A (Timer Start):

I assigned the value i want to pass (stopwatch_timer).

Here is my Worklfow B (Timer Stop):

I have created an argument in the argument-panel with IN Direction.

“Then getting back to workflow A, use a INVOKE WORKFLOW FILE activity and call the workflow B” → Why to use the “Invoke Workflow File”-Activity in Workflow A? Shouldn’t it be in Workflow B? Am i forgetting something or am i messing something up?

When it works at the end, a workflow x should looks like that:

flow

It confuses me quite a bit with the same error :frowning:

In invoke activity of workflow A we need to create OUT argument not IN argument

So that variable can be assigned to a variable with assign activity as you have done already

Cheers @kibar.albayoglu

1 Like

Hi,

Here is a sample to use StopWatch class in Invoke Code and Invoke Workflow File.

Hope this helps you.

Sample20211006-8.zip (5.1 KB)

Regards,

Good Morning Palaniyappan,

i have tried everything, with in, with out, in/out… every time the same error message. I don’t understand it. :confused:

For your Information, it is a library project. My goal is/was, to get the stopwatch functions as an activity in the activity-panel. I don’t know if that makes the difference.

Hello Yoichi,

thanks a lot also for you.

You know, i have created the workfiles exactly as in your Sample-File. Same Error -_- xD

Hi,

Can you share argument panel of the InvokeCode activity?

Regards,

Of course, here:

Hi,

Thanks, but it seems no problem. Can you share your workflow files (project), if possible?

Regards,

Here is the project-file.
Sample_Timer.7z (23.6 KB)

Thanks and Regards

Hi,

You need to set value at arguments panel of both invoke workflow file activity in Main.xaml as the following.
Can you modify them?

Regards,

The value in the argument panel of both “invoke workfile activity” is already set with “sw”. Or what do you mean?

Hi,

The following orange color means argument is not set completely.

If you open argument panel and there is variable which is same name with argument, it will automatically set. can you try to set in both argument, then run?

Regards,

1 Like

“The following orange color means argument is not set completely.”

Oh, i didn’t know that.

Now it works. Oh man, thanks a lot for your patience.

I will try it without the main.xaml now, because i want two activities in the activity-panel. When i publish this project, i will get 3 activities (with main,…).

1 Like

The create an Library with two workflows A (for Start) and B (for stop), to became two activities in the activ.-panel after publishing, we need in the workflow A an output argument in the argument panel and an output and input variables in the invoke-code arguments. Workflow B need only Input Variables in the argument panel and also in the invoke-code arguments.