Dynamic list Tree with folders filter



The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

I need to create folder tree structure, but only for the folder which actually contains searched items, not the whole hierarchy. Is there any way to do it?

1. I have created Dynamic list with custom query
2. I have created Form ListTree item for that query
3. The ListTree item shows only Folders
4. I need to present only Folder Hierarchy for the items which represent query result with LIKE condition.

Code
QueryText = "SELECT
            |   Nomenclatura.Ref AS Ref,
            |   Nomenclatura.IsFolder AS IsFolder,
            |   Nomenclatura.Description
            |FROM
            |   Catalog.Nomenclatura AS Nomenclatura
            |WHERE
            |   Nomenclatura.Description LIKE &SearchString";

 
#2
People who like this:0Yes/0No
Administrator
Rating: 19
Joined: Dec 4, 2017
Company:

Dear Alexey,

For your dynamic list, you can include the IsFolder = True filter like in the attached screenshot.



Best regards,
Vladimir Gurov

1C Company support team
 
#3
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Ok, I think I was not clear enough

Imagine that you have a huge list of items and categories. You are searching for something special (items). There are 2 coincidence in names of items searched and they are in 2 different categories (groups). So I need to show categories from the path to the item and not all the categories.

For example I have 100 categories and only in 2 items were found by the item description. So I need to present hierarchically the path to those items.
root -> cat B -> item1
root -> cat GH -> SubCat AZ -> item2
in form of a tree. Items should be excluded from the presentation.

The tree should not include any other categories(groups) if there is no items found down the hierarchy.

Edited: Alexey Gerasimov - Oct 18, 2018 11:12 AM
 
#4
People who like this:0Yes/0No
Administrator
Rating: 19
Joined: Dec 4, 2017
Company:

Dear Alexey,

With the new details you specified, you task becomes more complicated.

If your task is strictly bound to a dynamic list, you will not be able to solve it with the query language only.

For instance, you can additionally use a register with a string or Ref dimension for the full path to an item in the catalog and a resource for the item's path representation in the desirable format. First, you populate the register with the catalog item data and then you retrieve the data to the dynamic list according to the register via the left join in the query. The key point to consider is the way you update the register with the changes in the catalog items (for instance, upon the event of posting changes to the catalog).


Alternatively, instead of the dynamic list, you can use the data composition system (DCS) report. With DCS, you can create your custom function that processes the query results in the way you need.

Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe