cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a long method operation for modulo if mod or % is not a supported function/operator?

This is related to the Zeller's Congruence algorithm where there is a requirement to use Modulo to get the actual day of an input date. However, in the software I'm using which is Blueprism, there is no modulo operator/function that is available and I can't get the result I would hope to get.

In some coding language (Python, C#, Java), Zeller's congruence formula were provided because mod is available.

Would anyone know a long method of combine arithmetic operation to get the mod result?

From what I've read, mod is the remainder result from two numbers. But 181 mod 7 = 6 and 181 divided by 7 = 25.857.. the remainder result are different.

--------------------------------------------------
Disclaimer: This content was auto-posted from Stackoverflow. The original Stackoverflow question is here Stackoverflow Post, posted by erlomboy.
Hi  I am a Digital Worker. Please check out my profile to learn more about what I do!
1 BEST ANSWER

Helpful Answers

There are a couple of ways to execute a Modulo calculation within Blue Prism, either with a Calculation Stage or a Code Stage.

With a Calculation Stage, you are correct, you have to use a long form expression instead. That can be achieved with the following formula.
  • For example, 27 % 5 = 2, where 27 is the dividend and 5 is the divisor.
  • To achieve that in a Calculation stage: [dividend] - ((RndDn([dividend]/[divisor]))*[divisor])
With a Code Stage, you have C# and Visual Basic available to you, which means the Mod operator is available. You could either run your entire formula within a code stage, or just execute the Mod piece of the formula.

Cheers.

------------------------------
Charles Kovacs
Developer Consultant
Blue Prism
America/Chicago
------------------------------
Charlie Kovacs

View answer in original post

2 REPLIES 2

There are a couple of ways to execute a Modulo calculation within Blue Prism, either with a Calculation Stage or a Code Stage.

With a Calculation Stage, you are correct, you have to use a long form expression instead. That can be achieved with the following formula.
  • For example, 27 % 5 = 2, where 27 is the dividend and 5 is the divisor.
  • To achieve that in a Calculation stage: [dividend] - ((RndDn([dividend]/[divisor]))*[divisor])
With a Code Stage, you have C# and Visual Basic available to you, which means the Mod operator is available. You could either run your entire formula within a code stage, or just execute the Mod piece of the formula.

Cheers.

------------------------------
Charles Kovacs
Developer Consultant
Blue Prism
America/Chicago
------------------------------
Charlie Kovacs

Very soon, we will have a Utility Maths library available in the Digital Exchange (DX) this will be a free extension and will provide complimentary mathematics support to Blue Prism.

Please watch the Digital Exchange for more details over the coming week.

------------------------------
Geoff Hirst
Partner Pre Sales
Blue Prism
------------------------------
Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism