Filling the ValueTree as a form attribute from the query

The 1C:Enterprise developers forum

People who like this:0Yes/0No
Active user
Rating: 6
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:

|   InventoryBalance.GoodsItem,
|   InventoryBalance.Warehouse AS Warehouse,
|   SUM(InventoryBalance.QuantityBalance) AS Quantity
|   AccumulationRegister.Inventory.Balance AS InventoryBalance
|   InventoryBalance.GoodsItem,
|   InventoryBalance.Warehouse
|   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?
Result = Query.Execute();

SelectionWarehouse = Result.Choose(QueryResultIteration.ByGroupsWithHierarchy);

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

People who like this:0Yes/0No
Timofey Bugaevsky


Use the following:

// 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.

Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.