Creating and listing XData definitions
Hi InterSystems Community!
The ObjectScript language of InterSystems IRIS has the ability to extend classes using a very interesting feature called XData.
It is a section in your class that can be used to create custom definitions to be used within the class itself and also externally.
To create one or more XData definitions for your class is very easy, see the example:
Note that after defining the methods, just add one or more XData sections with three sections: XData NomeSecaoXData [MimeType = TypeOfMimeType]. The content is then placed between {}.
All XData elements are stored in the% Dictionary.XDataDefinition persistent class. This means that it is possible to retrieve the definitions using SQL language, internally or externally, see the example:
In this example, all XData elements with Mime Type markdown and html are retrieved and then have the name of the class where the XData is located and the description of the XData printed. If you want to retrieve the content, see GetXDataContent (thanks @Eduard Lebedyuk).
It is a very interesting feature, as we can catalog the documentation of all classes of an application and have easy access to them. Fantastic!
Comments
Hi
Before I start playing around with this functionality would it be possible for you to include a screen shot of the data retrieved by the SQL query?
Nigel
From the app:
.png)
From the Management Portal:
.png)