Skip to main content
May 19, 2023
Question

Grid values not populating correctly

  • May 19, 2023
  • 4 replies
  • 0 views

I have a grid as below. The thing is it is populating the country(s) column wrongly. India should be in third row, Mexico should be 2nd row and Saudi Arabia and Bangladesh should be in first row. The data we are passing is stored in the local variables and rule input correctly. But something is going wrong with the code to populate the grid column value. The code for grid column to populate Country(s) is below. Please help me in storing the correct values in to the grid.

a!gridTextColumn(
                label: "Country(s)",
                field: "country_txt",
                data: if(
                  rule!APN_isBlank(index(local!gridData, "data", {})),
                  {},
                  tostring(
                    sorttextarray(
                      stringArray: stripwith(
                        split(
                          index(
                            index(local!gridData, "data", {}),
                            "country_txt",
                            {}
                          ),
                          ";"
                        ),
                        " "
                      ),
                      isDescendingOrder: false()
                    )
                  )
                )
              )

Thanks in advance.

    4 replies

    sunilc6392
    May 19, 2023

    Hi Pavitra,

    Which version of Appian are you using, I see a!gridTextColumn instead of this you can use a!gridColumn in a! gridField, may it works.

    tushark6475
    May 19, 2023

    Hi Pavitra,
    I believe you are extracting the complete data of 'country_txt' from the local!gridData, which is returning an array or multiple countries and that's why it is getting populated in a single row.
    This code considers the complete data (country_txt) as a value for a single row.

    Participating Frequently
    May 19, 2023

    Hi Pavitra,

    Have you checked out for,

    1. Data is incorrectly defined, means of mapping mismatch or wrong decleration.

    2. trying with a!gridcolumn() 

    3. data is correctly defined for the values or not.

    stefanhelzle0001
    Brainy
    May 19, 2023

    That code line 7 and following is so weird. Why is this al necessary? The final problem comes from line 7 where you turn a list of items into a single string.