Get/Set Properties of a Spot

Mon 27. Mar 2017, 07:40

Hi there

I want to read/write the properties "Lat" and "Long" of a spot for which I have created a template. I was expecting to be able to read/write it the follwing way:
Code: Select all
                const string query = "SELECT * FROM SELF WHERE ObjectType = Spot";
                var resultSet = Session.RunQuery(query, refSelf);
                //MessageBox.Show(resultSet.Rows.Count.ToString());

                foreach (var obj in resultSet.Rows)
                {
                    Hotspot hotspot = new Hotspot();
                    hotspot.Name = obj.GetDisplayName();
                    hotspot.HotspotType = obj.GetTemplateTechnicalName();

                    if (obj.HasProperty("Lat") && obj.HasProperty("Lon"))
                    {
                        MessageBox.Show(obj["Lat"].ToString() + " " + obj["Lon"].ToString());
                        hotspot.Lat = Convert.ToSingle(obj["Lat"]) ;
                        hotspot.Lon = Convert.ToSingle(obj["Lon"]);
                    }
                    hotspots.Add(hotspot);
                }


However that seems to be incorrect. Can you guide me?

thanks and cheers

Martin
Slaughterjoe
 
Posts: 10
Joined: Fri 1. Jan 2016, 18:53

Re: Get/Set Properties of a Spot

Mon 27. Mar 2017, 14:44

Hi Martin,

Since the properties are part of a template (and to be more precise part of a feature) all those properties need to be referenced with the full feature name like:

MyFeature.Lat or MyFeature.Long

Only the objects "class" properties are accessible without using a qualified 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 7 guests

Who We Are
Contact Us
Social Links