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.
Discussion posts and replies are publicly visible
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
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
My I ask why you cannot call it recursively?
Good Stefan,Well, because I have the doubt of how to do it, I see that I cannot do it with a foreach because I do not have the starting list but from an id I have to find the superior one and as I told you I do not know how to do it I have the rule that returns me the top id but I don't know how to call it recursively.
Any idea or example?
A greeting and thanks in advance
You would just make a rule that gets the parent of the current object, if there is none it returns null, and if there is one it returns the parent and then calls itself again to get the parent of that object. When calling such a rule from a (separate) rule or interface, you would end up with an array of IDs that represents the entire hierarchy to root.
Good mike,
I have the problem with calling itself, I have the rule rule! GetFather, which it does is from the current id it gets the father's if there is one and I understand that I have to call it recursively, but I don't know how make the recursive call, since I can't use a foreach because I don't know how many there will be.
Any ideas?
Greetings and thank you
You just call the rule from itself. It's relatively easy once you wrap your head around the concept.
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 ), {} ) } )
Thank you very much Mike, your explanation and example have been very helpful to me!
Yup! Thanks for confirming.