Skip to main content
June 18, 2021
Solved

Path of a document or folder

  • June 18, 2021
  • 10 replies
  • 0 views

Good morning,

We have an interface in which we are using! DocumentAndFolderBrowserFieldColumns to paint a hierarchy of documents, the problem is that we are trying to obtain the path to display it as text in the following way,

if we have the following selected

we would have to obtain something like this:

"TST_Documentos_Texto_Con… / Prueba2/ Prueba1"

Has anyone had the same problem?

A greeting and thanks in advance.

    Best answer by mikes0011

    For a more concrete example... the following is the definition of TEST_findParentRecursive() which will find all folder IDs up to the root knowledge center.  The rule calls itself whenever it detects a parent object is present.  The result is an array of map objects containing various data from lowest-level to highest.

    a!localVariables(
      local!parent: folder(ri!folderId, "parentFolderId"),
      local!hasParent: not(isnull(local!parent)),
    
      {
        a!map(
          folder: ri!folderId,
          folderId: tointeger(ri!folderId),
          isTopmostFolder: not(local!hasParent),
          parentFolder: tofolder(local!parent),
          parentFolderOd: local!parent
        ),
        if(
          local!hasParent,
          rule!TEST_findParentRecursive(
            folderId: local!parent
          ),
          {}
        )
      }
    )

    10 replies

    danny.verb
    June 18, 2021

    I recommend the content tools plugin https://community.appian.com/b/appmarket/posts/content-tools

    You can use functions such as 'getdocumentsfromfolder' and 'getsubfolders' to create your own hierarchy 

    June 23, 2021

    Hi Danny thanks for the contribution, the problem is that I think I have to do the hierarchy from back to front, that is, file, parent folder, parent folder if there is one and so on, I have made a rule in which from I can get its parent for a given element (either from a file or a folder) the problem is that I can't call it recursively.
    Greetings and thank you

    stefanhelzle0001
    Brainy
    June 23, 2021

    My I ask why you cannot call it recursively?