Leap year

I have to create a 1-activity-library out of an Invoke Code activity that determines if a given year is a leap year or not, and publish it as a reusable component.

I have to create a separate Project that utilizes the created library. The implementation should contain a workflow where

  1. The user can ask for the number of days in a given year
  2. The workflow utilizes the above library
  3. Based on the result of the library invocation, the workflow determines the number of days in the given year
  4. The user is given an answer in a message box.

I think that something is wrong with my arguments. IThe code seems to work inside the library but when I am publishing the library and try to use it in other workflow it says that it is always leap year.

Then I am also thinking that if I have to put some arguments both the invoked code argument section and the other arguments section that I have marked with the red in the lower left corner.

  1. Invoke code activity image (library)

  1. Invoke code arguments (library)

  1. Workflow with input dialog and published library

1 Like

@Comet

In invoke code arguments link the year argument you created in the arguments tab to the invoke code argument…

Second in the place where you used the activity as library you have to pash the int_year variable…

Cheers

Thank you very much! Now the activity works very well.

I just have one further question that I now have to use message box activity to print the days in a given year. For example if the user inputs the year 2004 the code determines that it is a leap year and then I should be able to use message box activity to print the days in this year, 366. If the year is not a leap year the message box should print 365. And I have to use this Invoke Code Activity in this other Main Workflow as a reusable library. The message box should be in the Main Workflow.

I have not been able to succesfully do this so I must ask if you might know how to help me with this?

@Comet

In your invoke code and the library activity…

Add output argument and pass the value out as needed…

Now you are using a input variable similarly create an output variable with fidrection out…

In invoke code assign value to the variable …in place of write line use assign to assign it to thw out days variable

Hope this helps

Cheers

Thank you very much! This again solved my problem.

1 Like

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