Skip to main content
azlins352459
June 13, 2023
Question

How to join particular elements from 2 different lists

  • June 13, 2023
  • 4 replies
  • 0 views

I have two local variables storing list of numbers:

How can I get coordinates from this like

1,1

2,1

3,1

4,1

based on column and row value together?

    4 replies

    June 13, 2023

    Check out merge() function: https://docs.appian.com/suite/help/23.2/fnc_looping_merge.html

    Try to look for suitable functions in documentation before posting here.

    https://docs.appian.com/suite/help/23.2/Appian_Functions.html

    stewart.burchell
    June 13, 2023

    To be fair, merge() isn't that intuitive, even if you knew that was the name you should be searching for.

    @azlins0001 - Sanchit is correct, you can use the merge() function which takes two lists - like those in each of columnPosiitons and rowPositions, and merges them by creating a "list of lists" where the items listed at each index are brought together into their own list:

    a!localVariables(
      local!columnPositions: { 1, 2, 3, 4 };local!rowPositions: { 1, 1, 1, 1 },
      fn!merge(
        local!columnPositions,
        local!rowPositions
      )
    )

    .;..which results in;

    June 13, 2023

    yeah, but the documentation link I shared, contains plenty of examples which can be referred for best understanding and also IMO a good practice to follow when you are learning.

    harshitb6843
    June 14, 2023

    See, honestly, list of list is something that is simply just not possible on Appian. The only function that can make it work is merge but instead of this, I would recommend going with a list of dictionaries and cast this to a dictionary. Something like this. 

    {
        {
            list: 1,1
        },
        {
            list: 2,1
        },
        {
            list: 3,1
        },
        {
            list: 4,1
        }
    }

    It is much easier to work and operate on!