Digital Exchange

Expand all | Collapse all

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

Jump to Best Answer
  • 1.  Is there a long method operation for modulo if mod or % is not a supported function/operator?

    Posted 08-29-2019 21:01

    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.


  • 2.  RE: Is there a long method operation for modulo if mod or % is not a supported function/operator?
    Best Answer

    Posted 09-18-2019 17:41
    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
    ------------------------------



  • 3.  RE: Is there a long method operation for modulo if mod or % is not a supported function/operator?

    Posted 09-19-2019 06:55
    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
    ------------------------------