Multiple data set sorting issue

Team,

I have a grid of 7 columns and which have data coming from one view (5 columns) and two columns in data coming from another view . It is causing a sorting issue in GRID because of multiple data set.

All columns are part of only one cdt , is there a way i can club it on runtime and resolve sorting issue ?

CDT : (FirstName,Lastname,email,created,username,count,active)

view 1 - (FirstName,Lastname,email,created,username)

View 2 - (count,active)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    I think you can offload the data into a list of map using some foreach statements, the map should become the variable that you pass to the "data" parameter of the grid, so that you can loop, view and sort the data from that map obj, I hope i did explain this correctly.

    Best of luck.

  • I'm also a little confused - if the data should be for the same CDT, why do you have two different views that are returning the data? Couldn't you create a single query that gets all the information you need?

  • 0
    Certified Senior Developer
    in reply to Peter Lewis

    I think you're right, it's possible to just solve it from the DB level, but if this person really needs to solve it in an expression I have coded what i originally said in the below code by mixing two data Types into one.

    a!localVariables(
      local!dataType1: {
        a!map(name: "test1", date: today()),
        a!map(name: "test2", date: today() - 1)
      },
      local!dataType2: {
        a!map(year: year(today()), flag: "123"),
        a!map(year: year(today() - 400), flag: "456")
      },
      local!dataTypeMix: {
        if(
          count(local!dataType1) <> count(local!dataType2),
          null,
          a!forEach(
            local!dataType1,
            a!map(
              name: local!dataType1[fv!index].name,
              date: local!dataType1[fv!index].date,
              year: local!dataType2[fv!index].year,
              flag: local!dataType2[fv!index].flag,
              
            )
          )
        )
      },
      local!dataTypeMix
    )

Reply
  • 0
    Certified Senior Developer
    in reply to Peter Lewis

    I think you're right, it's possible to just solve it from the DB level, but if this person really needs to solve it in an expression I have coded what i originally said in the below code by mixing two data Types into one.

    a!localVariables(
      local!dataType1: {
        a!map(name: "test1", date: today()),
        a!map(name: "test2", date: today() - 1)
      },
      local!dataType2: {
        a!map(year: year(today()), flag: "123"),
        a!map(year: year(today() - 400), flag: "456")
      },
      local!dataTypeMix: {
        if(
          count(local!dataType1) <> count(local!dataType2),
          null,
          a!forEach(
            local!dataType1,
            a!map(
              name: local!dataType1[fv!index].name,
              date: local!dataType1[fv!index].date,
              year: local!dataType2[fv!index].year,
              flag: local!dataType2[fv!index].flag,
              
            )
          )
        )
      },
      local!dataTypeMix
    )

Children