11-22-2016 03:24 PM
I have an indexed set of named properties, such as X1, X2, X3, etc, and I want to get the right one when I have 1, 2, or 3. I can easily create a string "X2" from that. So I need to do something like
me.properties("X2").value. But that doesn't work (it is returning 0, and not throwing an error). What is the right incantation here?
Solved! Go to Solution.
11-22-2016 04:53 PM
Here is an example:
Automobile PartFamily
Property X1 = "Audi"
Property X2 = GetValueFrom(Me, "X1")
In custom.vb have a function like:
public Function GetValueFrom(p as obj, prop as string) as string
return p.Properties(prop).Value
End Function
Hope this helps and answers your question.
Thanks,
-Thilak Rao
11-23-2016 03:42 PM
To all: It turns out me.Foo.Bar is equivalent to me.Foo.Properties("Bar").Value, which is what I thought and Thilak put into his function. The reason it wasn't working for me before was that I had a "bad foo". That is, the error was in the object being accessed (it was a connection).
11-23-2016 04:14 PM
Just to clarify - I don't think you can do this inside RS Architect
Me.Foo."Bar" (Since you have "Bar" as a string"). Of course this is valid Me.Foo.Bar.
11-24-2016 08:10 AM
All works fine for me.
The code:
Dim text_str As String = "The value of property " & Input_String & " is " & Me.Properties(Me.Input_String).Value msgbox(text_str)
Probably you need to verify your syntax, references, datatypes.