This value is for user input. If you want to set filter in script, you will have to create a report form, and set it during form is created.
When you do so you will have an access to settings composer. There will be 3 groups of settings: Settings, UserSettings and FixedSettings.
You should set default values in Settings (if you can't set right value in Designer mode, of course).
Some settings that are marked as allowed for user edit will appear in UserSettings and if a user will change it, values will be changed in this collection and applied from it to the report.
You can also use FixedSettings to protect them from being changed by a user, but it is not very convenient as you will have to monitor if a user added same filter to UserSettings.
Here is an example:
Code |
---|
&AtServer
Procedure OnLoadUserSettingsAtServer(Settings)
Value = 12;
FilterField = New DataCompositionField("Price");
For Each FilterItem In Report.SettingsComposer.Settings.Filter.Items Do
If TypeOf(FilterItem) = Type("DataCompositionFilterItem")
And FilterItem.Use
And FilterItem.ComparisonType = DataCompositionComparisonType.GreaterOrEqual
And FilterItem.LeftValue = FilterField Then
FilterItem.RightValue = Value;
UserSettingID = FilterItem.UserSettingID;
For Each UserSetting In Report.SettingsComposer.UserSettings.Items Do
If UserSetting.UserSettingID = UserSettingID Then
UserSetting.RightValue = Value;
Break;
EndIf;
EndDo;
Break;
EndIf;
EndDo;
EndProcedure |