Skip to main content
azlins352459
New Participant
Jun 13, 2023 1:27 PM UTC
Question

How to join particular elements from 2 different lists

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

    sanchitg0002
    Inspiring
    Jun 13, 2023 1:34 PM UTC

    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
    Employee
    Jun 13, 2023 1:56 PM UTC

    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;

    sanchitg0002
    Inspiring
    Jun 13, 2023 2:13 PM UTC

    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
    Brainy
    Jun 14, 2023 5:59 AM UTC

    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!