My code can build an ECQuery that interrogates Item Type instances. I would like to create a Report that emulates that ECQuery. Is there any way to translate an ECQuery to a Report filter? That is, user has queried a set of elements by filtering their Item Type properties and can see a result set of, say, highlighted elements.
I expect that user would like to create a Report that lists those same element properties. This is an analog of queries and reports in most relational databases: a report can use an SQL query as the source of its data. Filtering is implicit.
I'm not optimistic about a positive response because the Report filter syntax is undocumented (in the Update 9..13 SDK) and obscure, so I have no idea where to begin.
Hi Jon,
Can you please elaborate more on your requirement?
Are you pointing to MstnExamples/Annotations/ReportsExample/ReportsExample.h?
Thanks,
Mangesh
Mangesh.Shelar said:Can you please elaborate more on your requirement?
My code creates an ECQuery. That query enables a user to see a filtered set of tagged elements whose Item Type properties match the filter criteria.
The result set is confined to MicroStation. The user can see the matching DGN elements highlighted, for example, in a MicroStation view. User next wants to export the result to an external app. or to create a MicroStation Report. A Report can include a filter specification. However, the filter specification is not published.
There is no way to translate an ECQuery to a Report filter. User must mentally construct a Report filter from his query. I would prefer to construct a Report filter in code.
Mangesh.Shelar said:Are you pointing to MstnExamples/Annotations/ReportsExample/ReportsExample.h?
I don't know if I want to point at that example. It's not very helpful. The only reference to a filter is this commented line:
//Uncomment this line if you want to filter your data. //reportNode->SetRowFilter (L"this.DgnCustomItemTypes_VendorCatalogItem::VendorItem::OutofStock=False");
The filter mechanism is undocumented. The quoted filter string to me looks like C# code. The syntax is not published anywhere that I can find. The path to construct such a statement programmatically is, presumably, to write C# code from C++ and plug the resulting string into SetRowFilter. Just like constructing SQL statements on-the-fly for a relational DB — only we don't do that any more with stuff like LINQ around.
SetRowFilter
Regards, Jon Summers LA Solutions
Jon,
As I began replying to your questions a sense of déjà vu led me to this very similar topic from 4 months ago: https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/147847/connect-c-item-types---report-filter-syntax/451925#451925
To summarize: the syntax is ECExpressions; the weird double-colon stuff is a recent addition to that syntax for disambiguating property access strings; MicroStation supports converting an ECQuery to an ECReport; an enhancement has been filed for making the API for doing so publicly available.
HTH,
Paul
Paul Connelly said:MicroStation supports converting an ECQuery to an ECReport
Aha! An API for that would be welcome.
Paul Connelly said:a sense of déjà vu
Well, it's more a sense of déjà demandé, since it's the same line of questioning.
Jon Summers said:Mangesh.Shelar
Seems to have a viewpoint on this stuff as well.
If you are looking for Microstation > Analyze ribbon -> Reports, Paul's suggestion is correct. I could see public APIs. But I don't see appropriate SDK examples. My colleague is looking in to it. I will let you know when he has something. Thanks.
Mangesh.Shelar said:I will let you know when he has something
Mangesh.Shelar: Any progress on Report Filter examples?
We couldn't publish these APIs as is. Also there are few more requests from you and some other users for some other report related APIs. However, there are few more important enhancements, mostly reported on communities. For those enhancements we need to change reports and tables. Which need us to change APIs at good level. For this year, we couldn't work on report. Apart from correcting *Report on Selection*, there is no good changes in reports. However, for next release we are taking up reports and tables. Once those enhancements are in good shape, we will publish all related APIs.
Thanks, Mangesh.
Mangesh.Shelar said:For those enhancements we need to change reports and tables
We enhanced AreaAnnotator's reports capability without using the MicroStation APIs...
The above screenshot is an AreaAnnotator report of instances of Item Type library AreaAnnotator class Area Feature. We have implemented various customer requests that are not available with MicroStation Reports...
AreaAnnotator
Area Feature
From the above dialog one can export an Excel file or create a Table in MicroStation.
Looks nice.
If you don't mind can you please help me with for following:
1. What is *Alternative Metrics*? I mean, are you doing any unit conversion?
2. About create table in Microstation: Here, are you copying values from this view or are you executing your definition at Microstation table level.
Thanks,Mangesh
Mangesh.Shelar said:What is *Alternative Metrics*?
Some customers create designs with annotation in two metric systems. For example, modellers in most of the world prefer the metric system (metres, hectares) while US modellers think in Imperial/English units (feet, acres). If a multinational shares designs between two locales that have different measuring systems, they want to see annotation and reports that show both units.
That helps to avoid the problems of misusing a measurement, such as infamously sending a space vehicle to the wrong location.
Mangesh.Shelar said:are you doing any unit conversion?
Yes: that's essential! For example, in the screenshot above, you can see column heading Area and below it units m2 and Yards2.
Mangesh.Shelar said:are you copying values from this view or are you executing your definition at Microstation table level
It creates a MicroStation Table in the same way that a Report creates a Table. The table shows what's in the worksheet, including the aggregate information. You can also write the worksheet contents as an Excel file.