How to display files in a grid with details?

Certified Associate Developer

Hi,

I found a code that explain how to display files in a grid, but my problem is that I can't create new columns with more information, for example the Description of the file. Please, can you give an advice?

This is my currect code. Thanks a lot.

load(
local!data: {
{
id: 1,
folderId: 4768/* Folder ids*/

},
{
id: 2,
folderId: 4947/* Folder ids*/

}
},
a!gridLayout(
label: "Documentación",
labelPosition: "ABOVE",
headerCells: {
a!gridLayoutHeaderCell(
label: "Nombre documento"
)
},
columnConfigs: {},
rows: {
a!forEach(
items: local!data,
expression: a!gridRowLayout(
id: fv!index,
contents: a!richTextDisplayField(
value: a!forEach(
items: folder(
index(
fv!item,
"folderId",
{}
),
"documentChildren"
),/*Getting documents from folder*/
expression: {
a!richTextItem(
text: document(
fv!item,
"name"
),
link: a!documentDownloadLink(
document: fv!item
)
),
a!richTextItem(
text: char(10),
showWhen: not(
fv!isLast
)
)
}
)
)
)
)
},
selectionSaveInto: {},
validations: {},
shadeAlternateRows: true
)
)

  Discussion posts and replies are publicly visible

Parents
  • The problem here is that you will need to again query all the documents in other column and then use document() function on it. 
    You don't have those documents as part of your data subset. So either you add it in your data or you query the folder again to get a list of documents. 

  • 0
    Certified Associate Developer
    in reply to Harshit Bumb (Appyzie)

    This is my code with the Description column and I recieve an error message:

    load(
                local!data: {
                  {
                    id: 1,
                    folderId: 4768/* Folder ids*/
    
                  },
                  {
                    id: 2,
                    folderId: 4947/* Folder ids*/
    
                  }
                },
                a!gridLayout(
                  label: "Documents",
                  labelPosition: "ABOVE",
                  headerCells: {
                    a!gridLayoutHeaderCell(
                      label: "Name"
                    ),
                    a!gridLayoutHeaderCell(
                      label: "Description"
                    )
                  },
                  columnConfigs: {},
                  rows: {
                    a!forEach(
                      items: local!data,
                      expression: a!gridRowLayout(
                        id: fv!index,
                        contents: 
                        a!richTextDisplayField(
                          value: a!forEach(
                            items: folder(
                              index(
                                fv!item,
                                "folderId",
                                {}
                              ),
                              "documentChildren"
                            ),/*Getting documents from folder*/
                            expression: {
                              a!richTextItem(
                                text: document(
                                  fv!item,
                                  "name"
                                ),
                                link: a!documentDownloadLink(
                                  document: fv!item
                                )
                              ),
                              a!richTextItem(
                                text: char(10),
                                showWhen: not(
                                  fv!isLast
                                )
                              )
                            }
                          )
                        ),
                        a!richTextDisplayField(
                          value: a!forEach(
                            items: folder(
                              index(
                                fv!item,
                                "folderId",
                                {}
                              ),
                              "documentChildren"
                            ),/*Getting documents from folder*/
                            expression: {
                              a!richTextItem(
                                text: document(
                                  fv!item,
                                  "description"
                                )
                              ),
                              a!richTextItem(
                                text: char(10),
                                showWhen: not(
                                  fv!isLast
                                )
                              )
                            }
                          )
                        )
                      )
                    )
                  },
                  selectionSaveInto: {},
                  validations: {},
                  shadeAlternateRows: true
                )
              )

  • It's because you are not passing gridRowLayout contents in an array

Reply Children
No Data