List and library lookup show content by folders

Good day, @mnikitina!
I have 2 lists. In list1 i have an list and library of list2, List2 now has more than 5000 elements. i would like to move them in folders. Is it a way to show in list 1 in lookup lists and library content of the folders of list2?

Dear @ixxxl,
Sure, there are plenty of methods for working with folders/showing specific folders and more. What exactly are you interested in? You can create folders for each item in List 1, for example, and only show contents of this specific folder in List or Library.

You can find more information about working with Root Folder property here - https://plumsail.com/docs/forms-sp/how-to/root-folder.html

@Nikita_Kurguzov
I tried to make like in manual image it works. but if i will have more folders?
list1 - list of productive data
list2 - history of different stages making in list1.for now it is more than 5000.
i want to have possibility to see on each item in list1 history of list2. it's work perfect. But when in list 2 there is more than 5000 i think to move older items in folders (with the time it will be 50,100,200.. folders) but in list1 i want to enter in different item and to see in list and library control only history for this item, without folders. connected by lookup field.

Dear @ixxxl,
The same article contains information on how you can change the Root Folder dynamically -https://plumsail.com/docs/forms-sp/how-to/root-folder.html#change-root-folder-dynamically

You can set it based on current item, or remove this property entirely under the right condition.

1 Like

@Nikita_Kurguzov
thank you, it works,
i have another issue. i have list 1 (parent). The form on list 1 is saving and workflow create folder in list 2 with its title name. When edit form in list 1 user create an item in list and library control of list 3. In child of list 1 form it have one more list and library to list 2. When i add new item here i want it will be created in folder that was created previously, but item is created in root folder of list.

Dear @ixxxl,
Could you provide some screenshots of your setup? It's very hard to say what you mean. Is it a parent -> child -> grandchild relationship between the three lists?

@Nikita_Kurguzov
list 1 - parent -


THIS One is opened from the first screen by button Adaugati versiune ANI

hERE i would like to create items that will be stored in special folder. but not in root of list

Dear @ixxxl,
Okay, so what is the issue? You just need to use custom code on the form itself (child which has List or Library on it) and set root folder dynamically.

How do you know which folder to save to? Do you need to create a folder dynamically?

1 Like

@Nikita_Kurguzov
Folder i create with workflow after first save of main parent form, with the name of list item
Then i set root folder dynamically.

fd.spRendered(function(ctx) {
   var dt = fd.control('SPDataTable1');
   dt.ready().then(function() {
       setRootFolder();
   });

   //set root folder when Category field changes
   fd.field('Title').$on('change', function() {
       setRootFolder();
   });

   function setRootFolder(){
       var category = fd.field('Title').value;
      
           dt.baseRootFolder = category;
           dt.rootFolder = category;
       
   }
});

And when i create new item in this child section in list and library control it stores item not in new folder just created, but in root of list.

I found a mistake , i was wrong in spdatatable. and it works, thank you
Now it create items in folder as i want!!

Dear @ixxxl,
Okay, that is awesome! Glad to hear it :blush:

One thing though - if the folder is already created when you open an item, you might not want it to change if the user changes the Title. Instead, you can remove the following part:

  //set root folder when Category field changes
   fd.field('Title').$on('change', function() {
       setRootFolder();
   }); 

and replace it with disabling the Title field, so it couldn't be changed by the user, if it's so important to match the folder name:

fd.field('Title').disabled = true;

Of course, this is optional, and if everything works as you want it to, you don't need to change anything.

@Nikita_Kurguzov
Thanks a lot , i will use it. Is a great remark.

i have one more thing ang waiting Margarita to help me :slight_smile: it's about populate field from parent to child, and child second level2