regarding grids with form

How can we get in uploaded Document name ,uploaded by and uploaded on in supervisor form using grids of 3 column.

  Discussion posts and replies are publicly visible

Parents
  • Assuming that document is already uploaded, as Stefan notes, you can retrieve those properties using the document() function, such as:

    a!localVariables(
      local!doc: /* Your Document(s) here */,
    
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Document Name"),
          a!gridLayoutHeaderCell(label: "Uploaded By"),
          a!gridLayoutHeaderCell(label: "Uploaded On")
        },
        rows: a!forEach(
          items: local!doc,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"name")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"lastUserToModify")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"dateCreated")
                )
              )
            }
          )
        )
      )
    )

  • a!localVariables(

    local!doc:/* your documents here*/

    So here documents in the sense target documents or what?

    So my target documents here cons!name of file.

  • I'm still not sure if the code you posted is the Supervisor Form, or if it is the submission form prior to the Supervisor Form.

    As Stefan noted initially here, the form where you are uploading documents must be submitted to turn the upload into a document type object.  You cannot access the upload as a document type on the same form it is being uploaded on.  In the situation where you need to display the document properties on the same form (not sure why you would need to tell the uploader details on what they just uploaded), generally the theory is to submit the form without validations and chain back to itself.

    If the document has already been uploaded, you can use my code above and point to whatever document you want such as ri!vehicle.vehicleRCNumber.

  • yes I can use your code but the thing is uploaded document details is in cons! folder.

    So seems can't I use cons! folder in place of local!doc.

  • Gotcha, correct while you can't point to the folder directly in the code above, you can retrieve the documents that are within the folder using:

    folder(cons!YOUR_FOLDER, "documentChildren")

    Updating my code with the logic to retrieve docs from the folder:

    a!localVariables(
      local!doc: folder(cons!YOUR_FOLDER, "documentChildren"),
    
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Document Name"),
          a!gridLayoutHeaderCell(label: "Uploaded By"),
          a!gridLayoutHeaderCell(label: "Uploaded On")
        },
        rows: a!forEach(
          items: local!doc,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"name")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"lastUserToModify")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"dateCreated")
                )
              )
            }
          )
        )
      )
    )

  • folder(folderId, property)
    
    Returns a property of the requested folder. The return type will be the type of that property; for example selecting ’dateCreated’ as the property parameter returns a Date and Time value.
    
    Returns: Any Type
    
    folderId (Number (Integer)): The ID of the folder to be retrieved.
    can't use like that.

  • I will submit that, yes you can, until you show me an error message.

    Appian will convert the "folder" type object to it's ID for use within the folder() function automatically.

    I have tested this again successfully with my code locally.  I always suggest trying before assuming.

  • 0
    Certified Lead Developer
    in reply to JS0001

    This is what will happen if you don't use the folder() function correctly.  Please refer back to how Chris used it in his example, in particular the highlighted part:

    The properties you can pass into folder() are strictly defined, you can't just pass in random strings as you've done (i.e. passing in "SG_Document"), and expect it to work.

  • Yep.  Basically just replace "SG_Document" with "documentChildren" and you should be all set.

  • Hi.Yes replaced with that "documentChildren"Now I want to add 3 more cons!folder_name.How can it be done?

  • Replace your local!doc config with a!forEach() to iterate over your list of folders, such as:

    a!localVariables(
      local!doc: a!flatten(
        a!forEach(
          items: {
            cons!FOLDER1,
            cons!FOLDER2,
            cons!FOLDER3
          },
          expression: folder(fv!item, "documentChildren")
        )
      ),    
    
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Document Name"),
          a!gridLayoutHeaderCell(label: "Uploaded By"),
          a!gridLayoutHeaderCell(label: "Uploaded On")
        },
        rows: a!forEach(
          items: local!doc,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"name")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"lastUserToModify")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"dateCreated")
                )
              )
            }
          )
        )
      )
    )

Reply
  • Replace your local!doc config with a!forEach() to iterate over your list of folders, such as:

    a!localVariables(
      local!doc: a!flatten(
        a!forEach(
          items: {
            cons!FOLDER1,
            cons!FOLDER2,
            cons!FOLDER3
          },
          expression: folder(fv!item, "documentChildren")
        )
      ),    
    
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Document Name"),
          a!gridLayoutHeaderCell(label: "Uploaded By"),
          a!gridLayoutHeaderCell(label: "Uploaded On")
        },
        rows: a!forEach(
          items: local!doc,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"name")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"lastUserToModify")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"dateCreated")
                )
              )
            }
          )
        )
      )
    )

Children
No Data