Can any one help on this I need a function or a logic which gives expected outpu

Can any one help on this I need a function or a logic which gives expected output from two arrays.
each variable from array1 should map with all variables in array2.
{a,b} {c,d,e} output (a,c)(a,d)(a,e)(b,c)(b,d)(b,e)
{a} {b,c,d} output (a,b)(a,c)(a,d)

Thanks

OriginalPostID-210308

OriginalPostID-210308

  Discussion posts and replies are publicly visible

Parents
  • OK. Lets try this. I had to add another helper expression. This returns a true list of value pairs. I hope this is what you want.

    BuildValuePair(value1(any), value2(any)):
    ={ri!value1, ri!value2}

    HelperEx(map(any), list(any), value(any)):
    =append(ri!map, apply(
    rule!BuildValuePair(
    value1:_,
    value2:_
    ),
    merge(
    repeat(length(ri!list), ri!value),
    ri!list
    )
    ))

    Call:
    reduce(
    rule!TS_TestExpression(
    map:_,
    value: _,
    list: {"c", "d", "e"}
    ),
    {},
    {"a", "b"}
    )
Reply
  • OK. Lets try this. I had to add another helper expression. This returns a true list of value pairs. I hope this is what you want.

    BuildValuePair(value1(any), value2(any)):
    ={ri!value1, ri!value2}

    HelperEx(map(any), list(any), value(any)):
    =append(ri!map, apply(
    rule!BuildValuePair(
    value1:_,
    value2:_
    ),
    merge(
    repeat(length(ri!list), ri!value),
    ri!list
    )
    ))

    Call:
    reduce(
    rule!TS_TestExpression(
    map:_,
    value: _,
    list: {"c", "d", "e"}
    ),
    {},
    {"a", "b"}
    )
Children
No Data