[CONNECT C++] Add Formatting to a Report Column

The SDK example Annotations\ReportsExample shows how to create a report definition programmatically: create a set of ColumnDefinitionNodes...

ColumnDefinitionNodePtr columnNode = groupNode.CreateColumnDefinition (columnName, -1);
ReportColumnAccessorList accessors;
accessors.push_back (ReportColumnAccessor (QualifiedECAccessor (schemaName, className, accessString)));
columnNode->SetAccessors (accessors);

What is not shown, and what I can't find mentioned in MicroStationAPI help, is how to apply formatting to a report column.

  • Enhancement 694371 has been filed

    Has any progress been made with that enhancement?  I don't see anything in the SDK docs for Update 15 that mention report formatting.

     
    Regards, Jon Summers
    LA Solutions

  • The preferred trackable accountable way would be to file a help request located bottom right on your personal Connection Portal page (connect.bentley.com) and ask to file an Enhancement or Defect. Though as Paul mentions simply asking or making a clear point for an improvement or defect/bug may often result in a moderator, developer, or any Bentley colleague filing the request for you. Though not listed as best practice to my knowledge using logical tags may also help catch or find issue more easily. E.g. DefectRequest or EnhancementRequest.

    I will file a request first thing in the morning and update with the Enhancement request id.
     
    UPDATE (2014-04-28):  Enhancement 694371 has been filed for this issue.
     
    HTH,
    Bob
    --------



    Answer Verified By: Jon Summers 

  • Keeping quiet doesn't improve the SDK. Complaining loudly at least stands a chance of doing so.

    Since I can more or less freely modify the API to reduce my own inconvenience, I'll have to defer to Bob regarding the official process for requesting API enhancements.

    Best regards,
    Paul

    Answer Verified By: Jon Summers 

  • Unknown said:
    As you've probably noticed, the XDataTree API is not especially user-friendly

    I was keeping quiet about that The lack of a decent EC formatting API and its complete absence for formatting tables is a serious inconvenience...

    Unknown said:
    You may prefer to request that a convenient API be provided on ColumnDefinitionNode

    How does one go about requesting an enhancement to the API?

     
    Regards, Jon Summers
    LA Solutions

  • Jon,

    You will not find a convenient API for this.
    The Reports dialog uses the XDataTree API to do it.
    Basically the formatting is stored as an extra ECInstance on the column definition's XDataTreeNode.
    As you've probably noticed, the XDataTree API is not especially user-friendly.
    You *can* use that API to add/remove formatting - but the Reports dialog has lots of extra validation logic on top of that to ensure the formatting options specified are compatible with the column's data type.
    You may prefer to request that a convenient API be provided on ColumnDefinitionNode.

    Regards,
    Paul
  • Unknown said:
    By formatting are you referring to column values sort options?

    No, I mean formatting.  When annotating an element with Item Types, for example, we can create formatted text that follows the rules defined in the Mstn Property Formatter schema.

    When creating a Report, those same options are not available, at least programmatically.  When creating the TextBlocks to make that label, I use this, which is building a class instance of a formatter using the Mstn Property Formatter schema (thanks to Paul Connelly for his help in achieving this)...

    WCharCP                                 AreaClassName   { L"AreaClass" };
    ECN::ECClassCP                          formatClass     { formatSchema->GetClassCP (AreaClassName) };
    StandaloneECEnablerP                    enabler         { formatClass->GetDefaultStandaloneEnabler () };
    StandaloneECInstancePtr                 localInstance   { enabler->CreateInstance () };
    if (localInstance.IsValid ())
    {
      WCharCP                               PropUnits       { L"Units" };
      ECValue                               units           { nUnits };
      localInstance->SetValue (PropUnits, units);
      WCharCP                               PropAccuracy    { L"Accuracy" };
      ECValue                               valAccuracy     { accuracy };
      localInstance->SetValue (PropAccuracy, valAccuracy);
      WCharCP                               PropUnitDecorator { L"UnitDecorator"	};
      ECValue                               valDecorator      { decorator };
      localInstance->SetValue (PropUnitDecorator, valDecorator);
    }
    // use localInstance to create TextBlock

    I don't see anywhere in the API how to apply similar formatting to a Report column.  What I'm expecting or hoping is that there's a facility to assign a similar format to a column, and values assigned to that Report column will use that formatter when creating a table.  Perhaps I'm assuming too much?

     
    Regards, Jon Summers
    LA Solutions

  • By formatting are you referring to column values sort options (SetColumnName, SetAscending, SetCaseSensitive, SetApplyBeforeFormatting, and SetHideDuplicateValues) performed within ECReportNode (..\include\DgnPlatform\ECReportNode.h+109)?

    Thank you,
    Bob