Create a tab options using one of the column values in the datatbase table

hello,

I am trying to implement tab with one of the column values in the table.

Ex. There is one column name -"years" and it has values like 2022, 2023, 2024. I want to create a tab with the option for each year i.e 2022,2023,2024 and it shows related records for that year. Can I use record type filter or is there any other way to do it?

Thanks in Advance!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    you can take refrence from this code ->
      

    a!localVariables(
      local!datasubset: {
        /*your data*/
        a!map(id: 1, name: "Aman", iq: - 1, dob: 2001),
        a!map(id: 2, name: "Shadman", iq: 10, dob: 2002),
        a!map(id: 3, name: "Tarannum", iq: 100, dob: 2001)
      },
      local!tabs: union(index(local!datasubset,"dob",""),index(local!datasubset,"dob","")), /*tabs value from data/database, use union to avoid duplicates*/,
      local!selectedab,
      local!filteredData: if(
        a!isNotNullOrEmpty(local!selectedab),
        index(
          local!datasubset,
          wherecontains(
            local!selectedab,
            index(local!datasubset, "dob", "")
          )
        ),
        local!datasubset
      ),
      /*filtered data accoring to selected tab*/
      {
        /*tabs design  - you can use card in columns too */
        a!buttonArrayLayout(
          buttons: {
            a!forEach(
              items: local!tabs,
              expression: a!buttonWidget(
                label: fv!item,
                saveInto: a!save(local!selectedab, fv!item),
                style: if(
                  and(
                    a!isNotNullOrEmpty(local!selectedab),
                    fv!item = local!selectedab
                  ),
                  "PRIMARY",
                  "NORMAL"
                )
              )
            ),
            a!buttonWidget(
              label: "clear",
              style: "LINK",
              saveInto: a!save(local!selectedab, null)
            )
          },
          align: "START"
        ),
        a!gridField(
          data: local!filteredData,
          columns: {
            a!gridColumn(label: "", value: fv!row.id),
            a!gridColumn(label: "name", value: fv!row.name),
            a!gridColumn(label: "Iq", value: fv!row.iq),
            a!gridColumn(label: "Dob", value: fv!row.dob)
          },
        
          rowHeader: 1
        )
      }
    )

Reply
  • 0
    Certified Associate Developer

    you can take refrence from this code ->
      

    a!localVariables(
      local!datasubset: {
        /*your data*/
        a!map(id: 1, name: "Aman", iq: - 1, dob: 2001),
        a!map(id: 2, name: "Shadman", iq: 10, dob: 2002),
        a!map(id: 3, name: "Tarannum", iq: 100, dob: 2001)
      },
      local!tabs: union(index(local!datasubset,"dob",""),index(local!datasubset,"dob","")), /*tabs value from data/database, use union to avoid duplicates*/,
      local!selectedab,
      local!filteredData: if(
        a!isNotNullOrEmpty(local!selectedab),
        index(
          local!datasubset,
          wherecontains(
            local!selectedab,
            index(local!datasubset, "dob", "")
          )
        ),
        local!datasubset
      ),
      /*filtered data accoring to selected tab*/
      {
        /*tabs design  - you can use card in columns too */
        a!buttonArrayLayout(
          buttons: {
            a!forEach(
              items: local!tabs,
              expression: a!buttonWidget(
                label: fv!item,
                saveInto: a!save(local!selectedab, fv!item),
                style: if(
                  and(
                    a!isNotNullOrEmpty(local!selectedab),
                    fv!item = local!selectedab
                  ),
                  "PRIMARY",
                  "NORMAL"
                )
              )
            ),
            a!buttonWidget(
              label: "clear",
              style: "LINK",
              saveInto: a!save(local!selectedab, null)
            )
          },
          align: "START"
        ),
        a!gridField(
          data: local!filteredData,
          columns: {
            a!gridColumn(label: "", value: fv!row.id),
            a!gridColumn(label: "name", value: fv!row.name),
            a!gridColumn(label: "Iq", value: fv!row.iq),
            a!gridColumn(label: "Dob", value: fv!row.dob)
          },
        
          rowHeader: 1
        )
      }
    )

Children
No Data