> how to query data from 2 catalogs Departments and Users and output to Attribute2?
like so:
| Code | 
|---|
| &AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   Query = new Query("SELECT Catalog1.Ref, Catalog1.Description FROM Catalog.Catalog1 AS Catalog1");
   choosing = Query.Execute().Choose();
   
   Query = new Query("SELECT Catalog2.Ref, Catalog2.Description, Catalog2.Attribute1 FR OM Catalog.Catalog2 AS Catalog2");
   catalog2 = Query.Execute().Unload();
   catalog2.Indexes.Add("Attribute1");
   
   lTree = FormAttributeToValue("Tree");
   
   while choosing.Next() do
      newRow = lTree.Rows.add();
      newRow.Attribute2 = choosing.Description;
      
      rows = catalog2.FindRows(new Structure("Attribute1", choosing.Ref));
      For each lRow In rows do
         newRow2 = newRow.Rows.add();
         newRow2.Attribute2 = lRow.Description;
      enddo;
   enddo;
   
   ValueToFormAttribute(lTree, "Tree");
EndProcedure | 
> How to auto check all Users when a Department checked? 
You need process OnChange event handler of Attribute1
| Code | 
|---|
| &AtClient
Procedure TreeAttribute1OnChange(Item)
   currentRow = Items.Tree.CurrentData;
   
   SubRows = currentRow.GetItems();
   For each subRow In SubRows do
      subRow.Attribute1 = currentRow.Attribute1;
   enddo;
EndProcedure |