I have manually defined an Expression in an Item Type Property. The Expression is a simple arithmetic multiplication. When I look at an element's properties using the MicroStation Properties dialog I can see the result...
The Expression in this example is assigned to property buildingCount, which you can see is greyed-out in Properties because it's read-only. How do I obtain that calculated result programmatically so that I can show it in my app's Tool Settings dialog items?
What I currently see in my dialog is the Expression's Default Value (-1 in this example).
Hi Jon,
using what language?
You did not share any code, but my first try would be to access as any other EC property value. Or is it EC property value that gives you -1?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Šlegr said:is it EC property value that gives you -1?
Exactly!
Jan Šlegr said:You did not share any code
The code is not interesting. It fetches successfully a number of Item Type property values attached to an EC instance. I'm probably missing something, and perhaps the answer will appear with the Update 14 SDK. I'm anticipating more support in the SDK for Expressions with that Update.
Regards, Jon Summers LA Solutions
Jon Summers said:I'm anticipating more support in the SDK for Expressions with that Update.
EC Expressions are nothing new, they exists in EC world for ages (from very beginning), so I expect it's supported by API already. The fact that it was added to ItemTypes also would not change anything.
Jon Summers said:The code is not interesting.
Well, at least whether you prefer C++ or C# is important.
Jan Šlegr said:EC Expressions are nothing new, they exists in EC world for ages (from very beginning), so I expect it's supported by API already. The fact that it was added to ItemTypes also would not change anything
An Item Type that has an Expression shows the calculated result in the element Properties dialog. However, that Expression is not used by a MicroStation Report and the Expression's default value (-1 in this example) is reported. Evidently I'm not the only one seeking better API support for Expressions in Item Types.
Jon Summers said:An Item Type that has an Expression shows the calculated result in the element Properties dialog.
Yes, because ItemTypes are normal (but limited in terms of complexity and features) EC data. And the properties dialog is able to handle any general EC data.
There are a huge amount of classes in ECObject API, for example ECPropertyPane class or classes in Bentley.ECObjects.Expressions namespace that allow to manipulate with EC data / EC properties, including (I think) evaluating expressions.
Jon Summers said:However, that Expression is not used by a MicroStation Report and the Expression's default value (-1 in this example) is reported.
How does it relate to your original question how to access Expressions? I reported this issue several weeks ago already, it was confirmed, so we can expect it will be solved in some future version.
Jon Summers said:Evidently I'm not the only one seeking better API support for Expressions in Item Types.
I do not believe the reports problem has anything to do with API, because Properties dialog is able to handle expression, so internally in Bentley it's known how to do it. I guess it's more about synchronization of new features cross the whole products and when Expressions (which are still Technology Preview!) were added to Item Types, team responsible for reports did not add this feature yet.
With regards,
Hi Jon
Please take a look on below blog to check expression API.
Working with ItemType EC Expression using Managed, Native and COM API’s [Upcoming feature in MicroStation CONNECT Edition Update 14]
Also, report will support Expressions and will available in Update 14 build.
Answer Verified By: Jon Summers