I have the following code that instantiates an Inline XBRL document. When I iterate over the facts list I get the name of each fact but how do I access the value? According to the documentation the only fields in a Fact are hidden, id and name.
InlineXbrlDocument xbrlDoc = new InlineXbrlDocument(zipFileName.Replace(".zip", "") + "/" + primaryDocument);
foreach (InlineFact fact in xbrlDoc.Facts)
Console.WriteLine($"Fact: {fact.Name}");
Produces output like:
Fact: us-gaap:StockholdersEquity
Fact: us-gaap:NetIncomeLoss
Fact: us-gaap:NetIncomeLoss
Fact: us-gaap:ShareBasedCompensation
Fact: us-gaap:ShareBasedCompensation
Fact: us-gaap:DepreciationDepletionAndAmortization
Fact: us-gaap:DepreciationDepletionAndAmortization
Fact: us-gaap:GainLossOnInvestments
Fact: us-gaap:GainLossOnInvestments
0000320193-25-000057-xbrl.zip (163.6 KB)
@John.Hammond82
To access the value of each fact in an InlineXbrlDocument, you can utilize the Value property of the InlineFact class. The InlineFact class typically contains properties that allow you to retrieve the value associated with each fact.
Here’s how you can modify your existing code to print both the name and the value of each fact:
InlineXbrlDocument xbrlDoc = new InlineXbrlDocument(zipFileName.Replace(".zip", "") + "/" + primaryDocument);
foreach (InlineFact fact in xbrlDoc.Facts)
{
Console.WriteLine($"Fact: {fact.Name}, Value: {fact.Value}");
}
In this code snippet, fact.Value retrieves the value of the fact, allowing you to display it alongside the fact’s name. Make sure that the Value property is available in the version of the Aspose.Finance library you are using, as the API may vary between versions.
If you encounter any issues or if the Value property is not available, please check the documentation or the API reference for the specific version of the library you are using.
The documentation doesn’t show a value property for the Fact class.
I have also tried the following code on every file in the zip attached to the first message and it fails when attempting to access XbrlInstances:
XbrlDocument document = new XbrlDocument(filePath);
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[0];
List<Fact> facts = xbrlInstance.Facts;
Console.WriteLine($"facts.Count = {facts.Count}");
I understand facts are supposed to be cast as items or tuples in order to access their values however I can’t populate facts through this method and I can’t seem to case InlineFacts as Facts or Items.
@John.Hammond82,
Thanks for the sample file.
You are right as I tested, the InlineFact class in Aspose.Finance.Xbrl provides limited direct access to properties like Name, Id, and Hidden. However, to access the value of the fact (such as the numeric or textual content reported in the XBRL instance), the Value property does not exist. We require to evaluate it in details.
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): FINANCENET-403
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.