Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > How to Set Data Type for Attribute of Composite Type?

Forum

Search UsersRules
How to Set Data Type for Attribute of Composite Type?
#1
Active user
Points:: 2
Joined:: Sep 16, 2011

In my document I have an attribute of composite type which consists of reference to catalog and string. Depending on type of document the form should let choose a catalog item in this field or input a text string. How can I set the default type for this field when the document type is changed?

Profile
#2
Just came
Points:: 10
Joined:: Apr 17, 2012

Code
   If TypeDoc = 1 Then
      TextBox = ""; // string
   ElsIf TypeDoc = 2 Then
      TextBox = Catalogs.Name.EmptyRef(); // ref
   EndIf

Profile
#3
Active user
Points:: 2
Joined:: Sep 16, 2011

Wow! Thanks! That's what I needed.

Profile
#4
Just came
Points:: 10
Joined:: Apr 17, 2012

You are welcome! :)

Profile
#5
Active user
Points:: 1
Joined:: Jul 20, 2011

Hi, Xin Wang!

You can also use something like that:

Code
   If Object.IsCompany Then
      Items.Owner.TypeRestriction = New TypeDescription("CatalogRef.Companies");
   Else
      Items.Owner.TypeRestriction = New TypeDescription("CatalogRef.Counterparties");
   EndIf;

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.