Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Filling the ValueTree as a form attribute from the query

Forum

Search UsersRules
Filling the ValueTree as a form attribute from the query
#1
Active user
Points:: 2
Joined:: Sep 16, 2011

How to work with the ValueTree? I have created the GoodsByWarehouses ValueTree on the Form, columns are the GoodsItem – the reference to Goods catalog and the Warehouse – the reference to Warehouses catalog, and the Quantity of Number type.
Here is my query:

Code
"SELECT
|   InventoryBalance.GoodsItem,
|   InventoryBalance.Warehouse AS Warehouse,
|   SUM(InventoryBalance.QuantityBalance) AS Quantity
|FROM
|   AccumulationRegister.Inventory.Balance AS InventoryBalance
|
|GROUP BY
|   InventoryBalance.GoodsItem,
|   InventoryBalance.Warehouse
|TOTALS BY
|   Warehouse";

Now I want to fill the form attribute with nodes by Warehouse.
But I can't figure out how to create nodes. Do I have to create a new ValueTree, fill it and convert to the FormData?
Code
Result = Query.Execute();

SelectionWarehouse = Result.Choose(QueryResultIteration.ByGroupsWithHierarchy);

While SelectionWarehouse.Next() Do
    TreeData = GoodsByWarehouses.GetItems();
EndDo;

Profile
#2
Guest
Points::
Joined::

Use the following:

Code
// Getting the ValueTree from the query
TreeFromQuery = Query.Execute().Unload(QueryResultIteration.ByGroups);
// Placing the ValueTree on the form
ValueToFormAttribute(TreeFromQuery, "GoodsByWarehouses");

Or see the Syntax Assistant for: FormDataTree and FormDataTreeItem. The GetItems() method returns the collection of items of 1 level down. For the root it will be the top level items collection. After that you can work with that collection, add and/or delete items.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.