I am using the Aspose LINQ Reporting Engine. How can I replace missing members by their tags?
Input:
Some text <<[existsTag1]>> <<[missingTag1]>> <<[existsTag2]>> <<[missingTag2]>>
Expected output:
Some text existsTag1Value <<[missingTag1]>>
existsTag2Value <<[missingTag2]>>
@asposeuuups
To replace missing members with their tags using the Aspose LINQ Reporting Engine, you can enable an option that allows the engine to treat missing members as null literals. This way, instead of throwing an exception when a member is missing, it will simply not write any value to the report.
Here’s how you can implement this:
-
Enable the Option for Missing Members: You need to set the ALLOW_MISSING_MEMBERS
option when initializing the ReportingEngine
. This allows the engine to handle missing members gracefully.
-
Set a Custom Message for Missing Members: You can also specify a custom message that will be printed in place of the missing member. This can be useful if you want to indicate that a member was expected but not found.
Here’s a code example demonstrating these steps:
// Create an instance of the ReportingEngine
ReportingEngine engine = new ReportingEngine();
// Allow missing members
engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
// Set a custom message for missing members
engine.setMissingMemberMessage("<<[missingTag]>>");
// Build the report with your data source
engine.buildReport(...);
In this example, if missingTag1
or missingTag2
are not found in your data source, the output will include the tags themselves in the report, as you specified. For existing tags, their corresponding values will be displayed.
This approach allows you to maintain the structure of your template while clearly indicating where data is missing.
For more detailed information, you can refer to the official documentation on accessing missing members in data objects here.
@Professionalize.Discourse
This code produce next output:
Some text existsTag1Value <<[missingTag]>>
existsTag2Value <<[missingTag]>>
It is not what I am looking for, I want to save information about the original missing member name:
Some text existsTag1Value <<[missingTag1]>>
existsTag2Value <<[missingTag2]>>
@asposeuuups
Unfortunately, the feature is not supported at the moment. For the sake of its implementation, we have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27583
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.