Skip to main content
New Participant
Feb 7, 2023 2:11 PM UTC
Solved

By using expression rule i need to get the sample output

Hi

sample Input : {a,b,c},{100,200,300}


sample output :

a-100,a-200,a-300,b-100,b-200,b-300,
c-100,c-200,c-300

    abhayd3663
    Brainy
    Feb 7, 2023 8:03 PM UTC

    a!localVariables(
      local!a: { "a", "b", "c" },
      local!b: { 100, 200, 300 },
      joinarray(
        a!flatten(
          a!forEach(
            items: local!a,
            expression: a!localVariables(
              local!prevItem: fv!item,
              a!forEach(
                items: local!b,
                expression: concat(local!prevItem, "-", fv!item)
              )
            )
          )
        ),
        ","
      )
    )

    output: 

    "a-100,a-200,a-300,b-100,b-200,b-300,c-100,c-200,c-300"

    3 replies

    stefanhelzle0001
    Brainy
    Feb 7, 2023 2:33 PM UTC

    Can you share any existing code snippets? Is there a specific reason you now posted the third question which looks like being copied from some test?

    abhayd3663
    Brainy
    Feb 7, 2023 8:03 PM UTC

    a!localVariables(
      local!a: { "a", "b", "c" },
      local!b: { 100, 200, 300 },
      joinarray(
        a!flatten(
          a!forEach(
            items: local!a,
            expression: a!localVariables(
              local!prevItem: fv!item,
              a!forEach(
                items: local!b,
                expression: concat(local!prevItem, "-", fv!item)
              )
            )
          )
        ),
        ","
      )
    )

    output: 

    "a-100,a-200,a-300,b-100,b-200,b-300,c-100,c-200,c-300"

    mikes0011
    Brainy
    Feb 7, 2023 8:11 PM UTC

    fyi...

    The Expression Guru