Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > How to display owned data on the catalog item form

Forum

Search UsersRules
How to display owned data on the catalog item form
#1
Just came
Points:: 0
Joined:: Feb 6, 2013

Hi,

I have two catalogs: CatalogAdresses and CatalogClients. CatalogClients is owner of CatalogAdresses. On ItemFormClients there is DynamicList with adresses. Could you tell me how can I display adresses belongs to each client?

Profile
#2
Guest
Points::
Joined::

Hello, James.

Owners have a navigation panel on the left where links to catalogs having this catalog as an owner are listed. This data will be displayed in the list form that you can open using Addresses link.

See the infobase in the attached file as an example.

By the way, for your task it is much better to use Contact information subsystem from 1C:Subsystems Library.

Profile
#3
Just came
Points:: 0
Joined:: Feb 6, 2013

I know that. But how should look query (filter or section WHERE ..., I'm not sure) if I want to display addresses in the ItemFormClients in table?

Profile
#4
Active user
Points:: 0
Joined:: Sep 26, 2012

You can use this script for setting filter on DynamicList:

Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   FilterElement = DynamicList1.Filter.Elements.Add(Type("DataCompositionFilterItem"));
   FilterElement.LeftValue = New DataCompositionField("Ref");
   FilterElement.RightValue = Object.Ref;
EndProcedure

Profile
#5
Guest
Points::
Joined::

Yes, you do not need to perform joins in this case. You can use a dynamic list without of the custom query.

If you want to make Addresses item form to substitute owner automatically when you create an item in this list, you need to set filter by owner for this dynamic list.

But there might be already created filter by owner, for example saved by a user manually. So you should to search for existing filter first.

In addition you should update filter after the catalog item is written due to when a new item is created there is no reference to it and filter will not work correctly.

Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   SetAddessesOwnerFilter();
EndProcedure

&AtServer
Procedure AfterWriteAtServer(CurrentObject, WriteParameters)
   SetAddessesOwnerFilter();
EndProcedure

&AtServer
Procedure SetAddessesOwnerFilter()
   LeftValue = New DataCompositionField("Owner");
   RightValue = Object.Ref;
   FilterItem = Undefined;
   For Each CurFilterItem In Addresses.Filter.Items Do
      If CurFilterItem.LeftValue = LeftValue Then
         FilterItem = CurFilterItem;
      EndIf;
   EndDo;
   If FilterItem = Undefined Then
      FilterItem = Addresses.Filter.Items.Add(Type("DataCompositionFilterItem"));
      FilterItem.LeftValue = LeftValue;
   EndIf;
   FilterItem.RightValue = RightValue;
   FilterItem.ComparisonType = DataCompositionComparisonType.Equal;
   FilterItem.Use = True;
EndProcedure

See the example in attached files.

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.