Manage User Filter,ConditionalAppear, Group, Field Restrictions By Script

Common questions about 1C:Query language, Query builder tool and Data composition schema

#1
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Hi,

I have a Report. report works on DCS. In that schema as usually some fileds are restrcited completely (as attibute and as field). So in default this fields do not viewed or not available completely in filter, grouping etc.

But, I want to manage this proccess by script. According to users works, I have to manage this proccess. For example, sometimes A1 field must be restricted, sometimes not.

Code
Procedure ManageRestriction(Report,Restrict,FieldName,FieldDescription,FieldValueType) Export 
   
   Schema = GetFromTempStorage(Report.SchemaID);
   
   SchemaFields = Schema.DataSets.DataSet1.Fields;
   
   EkSütun_S = SchemaFields.Find(FieldName);
   
   If TypeOf(EkSütun_S) = Type("DataCompositionSchemaDataSetField") Then
      
      EkSütun_S.AttributeUseRestriction.Condition   = Restrict;
      EkSütun_S.AttributeUseRestriction.Field   = Restrict;
      EkSütun_S.AttributeUseRestriction.Group   = Restrict;
      EkSütun_S.AttributeUseRestriction.Order   = Restrict;
      
      EkSütun_S.UseRestriction.Condition   = Restrict;
      EkSütun_S.UseRestriction.Field   = Restrict;
      EkSütun_S.UseRestriction.Group   = Restrict;
      EkSütun_S.UseRestriction.Order   = Restrict;
      
      EkSütun_S.Title = FieldDescription;
      EkSütun_S.ValueType = FieldValueType;
      
   EndIf; 
   
   Report.SettingsComposer.Initialize(New DataCompositionAvailableSettingsSource(Schema));      
   Report.SettingsComposer.Refresh(DataCompositionSettingsRefreshMethod.Full);
   
   PutToTempStorage(Schema,Report.SchemaID);
   
EndProcedure


I thought that it would work, but not. Or initializing of settings composer is not enough?

 
#2
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Or while initializing composer, platform as source takes query? Editing fiels of dataset is not enough?

 
#3
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Good morning!

Am I right that you want to hide some columns from the report depending on the user access rights?

 
#4
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Yeap, you are right. But not only hide, DCS reports there is good property that user can create own report variants. I want to hide in variant editing mode too.

 
#5
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

As option, I can change each time query text. But I do not want to do this because, query text is a little bit different. For example, there is columns named c1, c2, c3 - this columns have types more than one. According to users work - synonyms, valuetypes and visiblity of that columns change only.

 
#6
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

It is better to provide users with different rights different variants of your report. Thus you can set an access using built-in Roles feature.

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