Report Attributes
Plain Output /Plain XML/Plain JSON
Tally provides the capability to export any report in XML and JSON format. The exported data follows a standardized format or structure to enhance readability. This includes proper indentation, line breaks after closing tags, and consistent formatting of nested elements. Most of the applications can directly consume the data available in standard format.
However, certain legacy or non-standard systems require a different format. These applications expect the data as a single, unformatted string, without indentation, line breaks, or styling. To support such use cases, the attribute Plain Output and its aliases Plain XML and Plain JSON can be used in a ‘Report’ definition. This attribute generates the XML and JSON output of the report without applying any formats and styles.
The default value is No.
Syntax
[Report: <Report Name>]
Plain Output: <Logical Expression>
OR
Plain JSON: <Logical Expression>
OR
Plain XML: <Logical Expression>
Where,
<Report Name> is the name of the report.
<Logical Expression> can be any expression that evaluates to a logical value.
Plain Output, Plain JSON, Plain XML are aliases of each other. Specifying any one of them in the Report and will impact both XML and JSON output of the Report
Example
[#Report: BalanceSheet]
Plain Output : Yes
OR
[#Report: BalanceSheet]
Plain JSON : Yes
OR
[#Report: BalanceSheet]
Plain XML : Yes
The output file of Balance Sheet will be exported without any formatting in XML and JSON format.
Keep XML Case
By default, when a report is exported in xml format, the xml tags are converted into upper case. For systems that are case-sensitive and expect tags in a specific case, the Keep XML Case attribute can be used in the Report definition. This ensures that the tag names are exported exactly as specified in the TDL using the XML Tag attribute.
Syntax
[Report: <Report Name>]
Keep XML Case : <Logical Expression>
Where,
<Logical Expression> can be any expression which evaluates to logical value YES/NO. By default, the value will always be No.
Example
[Report: TSPL Sample Report]
Keep XML Case : Yes
…..
…..
[Field: TSPL Sample Field]
XMLTAG : “TSPL Sample Field”
When this report is exported, the TSPL Sample Field tag will be exported in the given case.
Export Empty Fields
By default, when a report is exported in JSON format, only the field with value is exported, as this makes the output content lightweight. However, if you want to include even empty fields in the export, the same can be achieved by using the report level attribute ‘Export Empty Fields’. This logical attribute ensures that all visible fields, including those with empty values, are included in the JSON export.
Invisible fields, fields with width set to 0, or fields defined as Set As: “” are not exported, even with this attribute (default behaviour). This attribute will have no effect on such fields. In other words, a field with empty value should be visible and should have some width to get exported with this attribute.
Syntax
[Report: <Report Name>]
Export Empty Fields : <Logical Expression>
Where,
<Report Name> is the name of the report.
<Logical Expression> can be any expression which evaluates to logical value YES/NO. By default, the value will always be No.
Example
[#Report:Balance Sheet]
Export Empty Fields: Yes
When Balance Sheet is exported in JSON format, all the fields including the fields with empty values will be exported.
Export Header
In a connected environment, when communication happens over a network, TallyPrime can send GET or POST request to third-party applications and gather responses using collection capabilities. A GET request is always without a request body while a POST request has a request body. In both the cases, the request can include HTTP headers as required by the third-party application and the HTTP standards.
To support this functionality, you can use the attribute, Export Header in both Collection and Report definitions. This attribute in the Report definition allows you to specify the necessary HTTP headers when you send requests to HTTP servers, particularly useful for POST request payloads.
Syntax
[Report: <Report Name>]
Export Header: <String Expression>
Where,
<Report Name> is the name of the Report which is used to send POST Request payload in the Remote Request attribute of the Collection.
<String Expression>is a valid expression that evaluates to a string.
When the Export Header attribute is defined in both the Collection and the Report, the HTTP request will include headers from both sources. The headers are added in the following order: first from the Collection, followed by those from the Report.
The Export Header attribute in the Report is particularly useful when sending HTTP headers in GET and POST requests using actions such as HTTP Post and HTTP Request.
Example
When the request is sent, all the 3 headers are included as HTTP headers in the request.
[Collection: TSPLLeaveSummaryXML]
Data Source : HTTP XML: “http://localhost/ExportHeader/getleavedetails.php”
Export Header : “Accept:application/xml”
Export Header : “EmpId:5989”
RemoteRequest : TSPL Leave Request: UTF8
[Report: TSPL Leave Request]
Export Header: “Type: Leave Request”
……..
……..
In this setup, the HTTP request will carry the following headers:
- Accept: application/xml
- EmpId: 5989
- Type: Leave Request
Headers from the Collection are added first, followed by those from the Report.
