Filter for Tabular Sections / ValueTable

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 31, 2014
Company:

Hello!

How can I create a filter (e.g. that searches for a value in a specific column) for tabular sections or value tables via the 1C programming language? I know it is possible via the user interface (find or advanced search), but I need to change it dynamically in the background.

 
#2
People who like this:0Yes/0No
Administrator
Rating: 18
Joined: Oct 3, 2019
Company:

Hi Oliver,

yes it is possible.

Take a look at the example below:

suppose we have a document (screenshots 1 and 2).

This code sets a filter on the tabular section of this document:

Code
&AtClient
Procedure Command(Command)

   structureFilter = New Structure;
   structureFilter.Insert("Product", "Product_2");

   Items.Products.RowFilter = New FixedStructure(structureFilter);
   
EndProcedure



The result of the code in screenshot 3.

If we want to cancel the filter, then we need the following code:

Code
&AtClient
Procedure Command1(Command)

   Items.Products.RowFilter = New FixedStructure();
   
EndProcedure

Download scr_2.png (13.84 KB)
Download scr_3.png (18.23 KB)
 
Subscribe
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.