Detecting inheritance for custom properties

Mon 1. May 2017, 21:06

I've defined some custom text properties, and would like to iterate through the properties of an ObjectProxy and execute some code if they inherit from one of these custom properties. I'm trying something like...

Code: Select all
List<string> MyCustomPropertyNames = new List<string> {"foo","bar"};

foreach (var property in obj.GetAvailableProperties())
   var info = obj.GetPropertyInfo(property);
   if (MyCustomPropertyNames.Contains(info.DataType.ToString()))

... but info.DataType is always giving me Text. Is there a way to check for what the name of the inherited custom property is?
Posts: 14
Joined: Wed 19. Apr 2017, 22:08

Re: Detecting inheritance for custom properties

Tue 2. May 2017, 21:06

The GetAvailableProperties() method already return the names you are looking for.

If the name contains a dot '.' the property comes from a feature and has the form
Code: Select all
<feature-technical name>.<property-technical name>

if you need to check for a specific template you can use the
Code: Select all
obj["TemplateName"] as String

to check for a specific template technical name
User avatar
[Articy] Peter Sabath
Articy Staff
Articy Staff
Posts: 89
Joined: Wed 23. Nov 2011, 13:58
Location: Bochum

Return to articy:draft Macro Devkit

Who is online

Users browsing this forum: No registered users and 2 guests

Who We Are
Contact Us
Social Links