Expression rule

Certified Associate Developer

How to write a rule which takes two input a char and an integer,
ruleInput: (A,2)
Output: (A1;A2) 

anyone can give me the answer 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    The requirement is not clear. Share more details.

    You can create a rule input of Text type and then pass comma-separated data in that.

  • 0
    Certified Lead Developer
    in reply to Yogi Patel
    The requirement is not clear.

    I like defaulting to the laziest approach possible when the requirements aren't actually spelled out.  For instance, the result here is just a rule that returns "(A1;A2)", without specifying how the rule input (if any) is related to that (and my brain is too fried to try guessing).

    So here's my initial rule suggestion:

    Fullscreen
    1
    "(A1;A2)"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Straightforwardness: 10/10.  Flexibility for different rule inputs: ??/10.

Reply
  • 0
    Certified Lead Developer
    in reply to Yogi Patel
    The requirement is not clear.

    I like defaulting to the laziest approach possible when the requirements aren't actually spelled out.  For instance, the result here is just a rule that returns "(A1;A2)", without specifying how the rule input (if any) is related to that (and my brain is too fried to try guessing).

    So here's my initial rule suggestion:

    Fullscreen
    1
    "(A1;A2)"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Straightforwardness: 10/10.  Flexibility for different rule inputs: ??/10.

Children
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    Less lazy reply:

    let's pretend the rule input is actually 2 inputs, a character and a "times repeated".  I don't feel like writing a parser to accept a comma-separated value when that may have just been OP overly abbreviating what their input is going to be.

    Fullscreen
    1
    2
    3
    4
    a!forEach(
    enumerate(ri!repeats),
    ri!character & fv!index
    )
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    For "A" and 2, that gives us basically their prescribed output:

    For "C" and "11", it performs more of the same: