Hi everyone,
I have tried the following approach that is create a collection foldersCollection and filesCollection but the issue as soon as I add any new folders in the sub-levels it is also populated in the main level dropdown which should not happen.

The issue with this was if I add any folders in the sub-level then it was getting displayed in the dropdown1 (main-level).

(As you can see in the above Picture, Level-1 is a folder that I have created in a sub-level Others so it should not appear in the main level and it should be present in that respective level like on selecting Others: as main level then in the 2nd drop-down Level-1 should be shown as an option)
So my requirement is:
I have created a Document Library named: TrialLibrary



Which has the following columns Name, Modified By, Created By (all these are System defined ). I have just added one choice column named Tags: (with the following choices - development, integration, security) which I will be associating with the files (from SharePoint side)
So on the main level : I have created 2 folders Training and Others
These folders may have sub-folders inside them or may not.
For now I have added a folder inside Others - Certifications, Exploration
In Certifications (Location: Others->Certifications) I have added 2 pdf files and similarly in Exploration (sub-folder inside Exploration) have added 3 docx files (assuming).
In Training folder:
I have not created any folders have only added files (Assumption : 4 pdf files)
So now in Power Apps the structure will be:
The main level drop-down will only show the drop-down in the main level not any other folders in the sub-level (like the Exploration or Certification folder that is created in the sub-level of Other folder). It should only show Training and Others as option.
Now if user selects Others (in the dropdown 1) then it should all the files if there are any in the gallery and if there are any folders in that level (here Others has 2 sub-folders only those name should come in the dropdown as values). Suppose if we select the 'Training' folder as the main level then the following dropdown (next drop-down) should not be visible as the Training folder does not have any sub-folders inside it, in this case just show the file details (if there are any) in the gallery.
So if user selects Others (main-level) then the next drop-down should be shown with only the folder names that are in that level (not others). So user can select the folders or user can skip that. There will be final drop-down that will be visible (irrespective there are files or folders in that respective levels) which will be used for filtering the records.
The sub-level folders may increase depending on that we need to show and filter records, so the program should adapt accordingly (that is the dropdowns), for now I am having only 2 levels (including the main level).
How to keep track of the Parent folders (in the sub-levels).
If anyone has any idea about this do share, will be helpful.
Regards,
Sidhant.