General Attributes
JSON Tag As Desc Name at Part and Line Level
From TallyPrime 7.0 onwards, reports can be exported in the new well structured JSON format with valid tags and syntax. This can be experienced in
- Post request payload construction with Collection Datasource HTTP JSONEx
- Post request payload construction with Action HTTP Request
- JSON Data sent to DLL using Datasource PluginJSON
- Exporting Report using function where variable SVExportFormat is set to $$SysName:JsonEx
In all cases the default behaviour of JSON Tags of the Report data exported is as follows
- JSON Tags are exported from part to field and only fields with values are exported by default.
- If JSON Tag attribute is not specified, then the description name of the element is exported as tag name
- If JSON Tag is specified, then the data is exported with the specified json tag
The attribute JSON Tag as Desc Name is introduced to control the behavior of the export of Part and Line definition, as corresponding JSON Tag, in the exported JSON format of the report, in the absence of JSON Tag attribute specification. This attribute is applicable only for Part and Line definition. JSON Tag as Desc Name is a logical attribute with default value Yes.
In other words
- When JSON Tag attribute is not specified in Part / Line definition
- JSON Tag as Desc Name: Yes -> The Part/Line definition name is exported as JSON Tag corresponding to the element, in the exported JSON format of the report
- JSON Tag as Desc Name: NO -> JSON tag corresponding to the Part/Line is omitted or not exported, in the exported JSON format of the report
- When JSON Tag attribute is specified in Part/Line definition: JSON Tag as Desc Name attribute is ignored.
Syntax
[Part: <Part Definition>]
JSON Tag as Desc Name: <Logical Formula>
[Line: <Line Definition>
JSON Tag as Desc Name: <Logical Formula>
Where,
<Part Definition> : Name of the Part where the attribute needs to be specified
<Line Definition> : Name of the Line where the attribute needs to be specified
<Logical Formula>: Logical Value or Formula that evaluates to a Logical value
Example
[Function: CAT Ledger Export]
00: Set : SVExportFormat: $$SysName:Jsonex
01: Set : SVPrintFileName : “.\Export\LedgerReport.json”
02: Export: CAT Ledger List : Yes :Yes
[Report: CAT Ledger List]
[Form: CAT Ledger List]
Part: CAT Ledger Part
[Part: CAT Ledger Part]
Lines : CAT Ledger Line
Repeat : CAT Ledger Line : Ledger
Scroll : Vertical
JSON Tag as Desc Name : NO
[Line: CAT Ledger Line]
Fields : CAT Led Name
[Field: CAT Led Name]
Use : Name Field
Set as : $Name
|
Default JSON Output |
JSON Output when JSON Tag as Desc Name : NO in part CAT Ledger Part |
|
{ “catledgerpart”: { “catledgerline”: [ { “catledname”: “10Decoders Consultancy” }, { “catledname”: “10Decoders software” }, { “catledname”: “12 Clock Briyani – B014539” } ] } } |
{ “catledgerline”: [ { “catledname”: “10Decoders Consultancy” }, { “catledname”: “10Decoders software” }, { “catledname”: “12 Clock Briyani – B014539” } ] } |
JSON Tag/ XML Tag at Form, Part, Line, and Field Level
When you want to integrate any third-party solution with TallyPrime, you can send the data in a defined structure in JSON or XML Format by using the Report construct. The attribute XML Tag alias JSON Tag specifies the tag name under the UI definitions, Form, Part, Line, and Field. You can use this attribute to provide the tag name for the elements in the report sent as XML or JSON payload over http or to create the structure of the data in JSON file.
Syntax
[Form/Part/Line/Field: <Definition Name>]
JSON Tag : <String Expression>
[Form/Part/Line/Field: <Definition Name>]
XML Tag : <String Expression>
Where,
<Definition Name> – the name of the definition.
< String Expression> – any expression which evaluates to a string.
XML Tag and JSON Tag are aliases of each other. i.e. specify any of them in the Form/Part/Line/Field and it will impact both XML and JSON output of the Report
Variations of Attribute behaviour
- XML Output of the Report: When this attribute is not specified at the field level, by default definition name acts as a tag name. For Form/Part/Line, no tag corresponding to them will be exported.
- JSON Output of the Report when HTTP JSON or SVExportFormat is set to JSON: When this attribute is not specified at the field level, by default definition name acts as a tag name. For Form/Part/Line, no tag corresponding to them will be exported.
- JSON Output of the Report when HTTP JSONEX or SVExportFormat is set to JSONEx:
- The attribute even if specified at form level will be ignored
- When this attribute is not specified at the Part/Line/ field level, by default definition name acts as a tag name. This can be controlled with Part and line level attribute JSON Tag As Desc Name.
Example
[Function: CAT Ledger Export]
00: Set : SVExportFormat: $$SysName:Jsonex
;; 00: Set : SVExportFormat: $$SysName:Json
;; 00: Set : SVExportFormat: $$SysName:XML
01: Set : SVPrintFileName : “.\Export\LedgerReport.json”
;; 01: Set : SVPrintFileName : “.\Export\LedgerReport.xml”
02: Export: CAT Ledger List : Yes :Yes
[Report: CAT Ledger List]
[Form: CAT Ledger List]
Part: CAT Ledger Part
XML Tag: “Envelope”
[Part: CAT Ledger Part]
Lines : CAT Ledger Line
Repeat : CAT Ledger Line : Ledger
Scroll : Vertical
XML Tag: “Ledger List”
[Line: CAT Ledger Line]
Fields : CAT Led Name
XML Tag: “Ledgers”
[Field: CAT Led Name]
Use : Name Field
Set as : $Name
XML Tag : “Ledger Name”
|
XML Output |
JSON Output |
JSONEX output |
|
<ENVELOPE> <LEDGERLIST> <LEDGERS> <LEDGERNAME>10Decoders software</LEDGERNAME> </LEDGERS> <LEDGERS> <LEDGERNAME>12 Clock Briyani – B014539</LEDGERNAME> </LEDGERS> <LEDGERS> <LEDGERNAME>3c Water wash – B014002</LEDGERNAME> </LEDGERS> </LEDGERLIST> </ENVELOPE> |
{ “Envelope”: { “Ledger List”: { “Ledgers”: [ { “Ledger Name”: “10Decoders software” }, { “Ledger Name”: “12 Clock Briyani – B014539” }, { “Ledger Name”: “3c Water wash – B014002” } ] } } } |
{ “Ledger List”: { “Ledgers”: [ { “Ledger Name”: “10Decoders software” }, { “Ledger Name”: “12 Clock Briyani – B014539” }, { “Ledger Name”: “3c Water wash – B014002” } ] } } |
