Line
When you see a report, and see those cursor move from row to row, those rows are called as lines in TDL. In the order of the report interface structure which follows Report->Form>Part>Line> Field, a line is an Interface Definition contained within a Part and it consists of one or more fields or lines.
Syntax
[Line: <Line Name>]
Example
[Line: TSPL Details Line]
➥ Download the Line Samples
| Sample File | Attributes |
| RepeatedTotal | Border, Combine, Explode, Field, Key, Local, Use, Indent, Repeat, Page Break, Next Page, On, Stripe |
| LineFormat | DMPMode, Fixed, Height, Line, Remove, Right Field, Select, Space Bottom, Space Top, Empty, Skip Rows, Full Object, Option, Switch |
| Output | JSON Tag as Desc Name, JSON Tag, Pre Printed, Pre Printed Border, XMLAttr |
| Input | Access Name, Add, Replace, Delete, Invisible, Local Formula, No Cursor, Set |
Attributes
The Access Name attribute assigns a unique identifier to a line instance. This is particularly useful when the same line definition is repeated multiple times, as it allows each repetition to be uniquely referenced and accessed. Although primarily intended for repeated lines, an access name can be assigned to any line and used to reference that line from anywhere within the report.
A common use case is updating list variables when a form is accepted. The function $$AccessObj can be used to retrieve values from the object associated with a line identified by its access name and assign those values to list variables. This approach is used, for example, in the Multi Email Report of TallyPrime.
An access name remains valid only within the report context, or as long as the report context is available. Additionally, it can be used only when the line artefact has an associated object context.
Syntax
Access Name : <Access Name Formula>
< Access Name Formula > can be a formula which evaluates to a string.
Example
[Line : TSPL Sample Line]
Field : TSPL Sample Fld1, TSPL Sample Fld2
Access Name : “Repeated Line” + $$String:$$Line
Explanation
Here, the example shows that, with the specification of the attribute Access Name in the Line TSPL Sample Line, each repetition of the line TSPLSampleLine has access name which is a concatenation of the text ‘repeated line’ and the Line Number . For example -> Repeated Line1, Repeated Line 2 and so on.
A Border is a simple, yet powerful way to make your UI look clean, structured and visually appealing. Whether it is to box up all the fields of the line to show its title or to separate it from neighboring lines, Border attribute can be used to achieve all the requirements as a medium of separation or highlighting.
Syntax
Border: <Border Definition Name>
<Border Definition Name> is the name of the border definition or expression that evaluates to a border definition
Example
[Field: TSPL Title Field]
Field: Medium Prompt, TSPL Field
Border: TSPL Border
[Border: TSPL Border]
Bottom: Thick, Double Lined
Explanation
The example shows that the field TSPL Title Field shows text “Consolidated Finances” with a double line border below the text, as specified by the Border attribute.
Have you witnessed how in a columnar report where fields are repeated, the total column accurately displays the totals in TallyPrime, as per the number of columns displayed? Whether you add or delete the columns, the totals always show the correct value. This is possible because of the Combine attribute at the line level.
The Combine attribute is used in columnar reports to aggregate values from repeated instances of the same field.
At the line level, the Combine attribute specifies the repeated field whose values need to be accumulated across all repetitions. To display the aggregated value, another field in the same line can use the $$Total function, passing the repeated field name as its parameter.
For example, consider a report that displays the Billed Quantity for stock items across multiple columns. The field displaying the billed quantity is repeated in the line and specified in the Combine attribute. Another field in the same line uses Set As : $$Total: to retrieve and display the combined total of all repeated instances.
The Combine attribute works only with numeric field values such as Amount, Quantity, Number, and similar data types. It cannot be used to aggregate string-based field values.
Syntax
Combine: <Field Definition Name>
<Field Definition Name> is the name of the field definition which is repeated in the line that must be added up.
Example
[Line: TSPL CFBK Rep Details]
Fields : TSPLCFBK Rep Name, TSPLCFBK Rep Party, TSPLCFBK Rep Col Total
Repeat : TSPLCFBK Rep Party
Total : TSPLCFBK Rep Party
[Field: TSPLCFBK Rep Party]
Use : Qty Primary Field
Set as : $$ReportObject:$$CollectionFieldByKey:$BilledQty:@MyFormula:CFBKSummVoucher
MyFormula : ##PName + #CFBKRepName
Format : “NoZero”
[Field: TSPLCFBK Rep Col Total]
Use : Qty Primary Field
Set as : $$Total:TSPLCFBKRepParty
Explanation
In the example, the field TSPLCFBKRepParty shows the billed quantity is repeated in the line TSPLCFBKRepDetails and is also specified in Total attribute so that the values of the repeated columns are summed up. The Total value is retrieved in the field TSPLCFBKRepColTotal using the function $$Total.
Planning to print using a Dot Matrix printer? The attribute DMPMode lets you specify which Dot Matrix mode to use during printing. It kicks in only when Dot Matrix printing is active, and simply steps aside for other printing types.
Note that, the same attribute is available in Form, Part and line level, and specifying this attribute at line level overrides the specifications done in Part or Form, and applies to the current line and its components. However the same attribute can be used in the field to override the Line Part Form specification.
Syntax
DMPMode : <DMP Printing Mode>
<DMP Printing Mode>: Here the values allowed under this are: ‘Normal’, ‘Bold’, ‘Italics’, ‘Underline’, ‘Condensed’, ‘Enlarged’, ‘DoubleLine’
Example
[Line : TSPLBillHeader]
Field : TSPLBillHeader
DMPMode: Draft
Explanation
The example shows the line TSPLBillHeader where with the specification of the attribute DMPMode, the Dot Matrix Print mode is set as “Draft”. Which means when the report where the line belongs to, is printed using DMP printers, the report is printed in draft mode.
When a user opens a report and finds just the relevant information, then the report becomes his go to. Maybe he would like to see more information based on configuration, but the first look of the report showing just the basic information makes all the difference. And the attribute Empty when used wisely, can make that report user’s choice as this helps you remove the lines that’s not required to be shown. This attribute is especially used when you have a repeated line and you do not want certain lines to appear on the screen, thus filtering out the non-relevant information. Not just that, since this attribute empties out all the data held by the line, the line will not participate in the Part total (done using Total attribute of Part), thus giving the accurate picture of what you see is what you get.
The difference between this attribute and Remove If attribute is that, while both remove the line from the UI, in case of remove if, even if the line appears to be removed from the UI, it still participates in the part total.
Syntax
Empty : <Logical Expression>
<Logical Expression> is a logical value or expression that evaluates to a logical value
Example
[Line: TSPL Line Sample]
Field : TSPL Line Fld1, TSPL Line Fld2
Empty if: $ClosingValue <500
Explanation
The example shows the line TSPL Line Sample with the Empty attribute specification. Which implies that the lines where closing value is lesser than 500 will be removed from the UI and will not be considered for the Part Total.
One of the most important attributes that make hierarchical display of data possible in reports whether it’s in display mode or edit mode, adding the layer of simplicity, readability and ease of usability to the reports to present detailed information. Every report in TallyPrime uses this functionality. Current balance displayed below the ledger entries in voucher, detailed mode of all the reports, batch allocations shown under inventory entries in voucher, are some of the examples in TallyPrime that uses this attribute. Explode attribute takes part name that needs to be shown under the line and condition on which the explode should take place. And to top it off, you can have multiple levels of explosion in a report.
For example, if one is displaying StockGroups and stockitems under each stockgroup, then the line that repeats on stockgroups will explode to a part which has a line that repeats on stockitems of the stock group. You can further explode Batch allocations under the stockitems, making it a multi-level exploded information.
Related Functions
$$ExplodeOwner: The exploded part can refer to the line that explodes it via the function $$ExplodeOwner:#<Field Name >. Used usually to refer to any of the fields in the explode owner context for any condition in the exploded part.
$$ExplodeLevel: Gives the level of explosion. Usually used in setting the indent of the lines to show the hierarchy.
$$KeyExplode: This function checks if the keys Alt + F1 Or Shift + Enter are pressed or not and returns the logical values ‘yes’ Or ‘No’ accordingly. This is usually used in the Explode attribute condition.
Syntax
Explode : <Part Name> : <Logical Expression>
< Part Name > is the name of the Part which exploded from the line
< Logical Expression > is logical value or expression that evaluates to a logical value. if True, will result in an explosion.
Example
[Part: TSPL Line Group]
Line : TSPL Line Group
Repeat: TSPL Line Group : Group
Scroll: Vertical
[Line: TSPL Line Group]
Field : TSPL Line Group
Explode: TSPL Line LedGroup : $$KeyExplode
[Field: TSPL Line Group]
Set as: $Name
[Part: TSPL Line LedGroup]
Line : TSPL Line LedGroup
Repeat:TSPL Line LedGroup : TSPL LedGrp
[Line:TSPL Line LedGroup]
Field:TSPL Line Led
Indent: 2
[Field: TSPL Line Led]
Set as : $Name
Set Always: Yes
[Collection: TSPL LedGrp]
Type : Ledger
Child Of: #LineGroup
Explanation
Here the main Line TSPL Line Group repeats over collection Groups in the part TSPL Line Group, which explodes to a part TSPL Line LedGroup whose line repeats over collection TSPL LedGrp, that shows respective ledgers under the group. The specification explode attribute at the line level makes the explosions possible.
A Report in TDL is created using Form, Part, Line and Field. Field is the leaf element that displays data or takes data input. In the hierarchy of definitions, the Line contains Fields and the attribute ‘Field’ is used to specify the Field definition names that should be shown in the Line. This attribute arranges the specified fields in the given order aligned to the left end of the line. The attribute ‘Right Field’ arranges the fields in the given order aligned to the right end of the line. The fields mentioned automatically takes the object context from the line.
Note that a line can have either fields or line, and not both.
Syntax
Field:<Field Definition Name>
<Field Definition Name> is the field definition name
Example
[Line:TSPL Line LedGroup]
Field:TSPL Line Led, TSPL Line Led Cb
[Field: TSPL Line Led]
Use : NameField
Set as: $Name
[Field: TSPL Line Led Cb]
Use : AmountField
Set as: $ClosingBalance
Explanation
The example shows a Line TSPL Line LedGroup that has 2 fields – TSPL Line Led shows Name of Ledger and TSPL Line Led Cb shows the closing balance of ledger. These fields are positioned from left to right in the line as specified by the Field attribute.
When a part has a repeated line and other standalone lines after this repeated line like totals, while you want the cursor to scroll through the repeated information, you do not want it to focus on the totals line. The attribute Fixed when set to yes makes it possible to skip the cursor from focusing on the line in a part when Scroll is enabled with the Scroll attribute.
Syntax
Fixed: <Logical Expression>
<Logical Expression> is a logical value or expression that evaluates to a logical value
Example
[Line: TSPL Totals]
Field: TSPL Totals
Fixed: Yes
Explanation
The example shows that with the specification of Fixed attribute in the Line TSPL Totals, the cursor will not land on this line, when the part to which the line belongs to has Scroll attribute set to Yes.
This is a powerful attribute when it comes to integration, where you can export the complete object hierarchy of the primary objects along with udf values from TallyPrime in XML/JSON format within the custom output format.
Syntax
Full Object: <Logical Expression>
<Logical Expression> is a logical value or expression that evaluates to a logical value
Example
[Part: TSPL Line Group]
Line : TSPL Line Group
Repeat: TSPL Line Group : Group
Scroll: Vertical
[Line: TSPL Line Group]
Field : TSPL Line Group
Full Object: Yes
Explanation
Example shows that when the report to which the part TSPL Line Group belongs to, is exported in XML or JSON format, full object hierarchy of the groups is exported as the attribute Full Object is set to Yes in the Line TSPL Line Group and each repetition of the line is associated with a group as the line repeats over the collection Group in the part TSPL Line Group.
While a line has a default height, you can control the height of the line using this attribute. Whether it is to make the line look big or to reduce it further, this attribute will help you with it. And this height will inclusive of Space Top and Space Bottom mentioned. But a trivia for you is that if the height is specified in lines, then, the height doesn’t include space top and space bottom if specified, instead the space top and space bottom are added to the given height.
Also note that if the line has field with lines attribute set to 0 or more than 1 then each line the field occupies will have the height specified.
Syntax
Height:< Measurement Formula>
<Measurement Formula> is used to specify the Height in a specified unit of measurement.
A Unit of Measurement can be any of the following:
- Millimeters/mms
- Centimeters/cms
- Inch(es)
- Number of Lines
- % Screen/Page
- Number – Points (where 1 Point = 1/72 Inch)
Example
[Line: TSPL Line]
Field : TSPL Field
Height: 2
Explanation
The example shows the line TSPL Line will have a height of 2 lines, as specified by the attribute Height.
Have you observed when multiple levels of information are presented in TallyPrime reports, how neatly each line is intended to visually indicate the level of information? That’s where this attribute comes into play. Add smart spacing to your lines!
The attribute Indent lets you control how much each line should be indented from its starting point. So, the Fields of the line start after this indentation is honored. This attribute is typically used while displaying reports like List of Accounts, Trial Balance, etc., where the groups and ledgers under a particular group are recursively indented inside the group, based on the order of the groups and ledgers.
Note that even field has an Indent attribute, while the indent attribute of the field indents just the field content, the Indent attribute, indents the whole line, by the given measurement.
Syntax
Indent: <Measurement Formula>
<Measurement Formula> is the formula that evaluates to a number that indicates the number of characters
Example
[Line: TSPL Ledger Line]
Field : TSPL Ledger
Indent: 2
Explanation
The example shows that the whole line TSPL Ledger Line is indented by 2 characters, after which the contents of the field TSPL Ledger is placed, as specified by the Indent attribute.
Do you want the line to disappear in certain cases, like it seems like it never existed? This is the attribute that gives the line the superpower to become invisible. This is applicable only on stand alone lines and not repeated lines.
Syntax
Invisible: <Logical Expression>
<Logical Expression> is a logical value or expression that evaluates to a logical value
Example
[Line: TSPL Title]
Field : TSPL Field
Invisible: $$InExportMode OR $$InPrintMode
Explanation
The example shows that with the specification of the Invisible attribute, the line TSPL Title will be invisible when the report is exported or printed.
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
Syntax
JSON Tag as Desc Name: <Logical Formula>
<Logical Formula>: Logical Value or Formula that evaluates to a Logical value
Example
[Function: TSPL CustomerDetailsPost]
00: Set : SVExportFormat: $$SysName:Jsonex
01: Set : SVPrintFileName : “.\Export\LedgerReport.json”
02: Export: TSPL CustomerDetailsPost: Yes :Yes
[Report: TSPL CustomerDetailsPost]
[Form: TSPL CustomerDetailsPost]
Part: TSPL CustomerDetailsPost
[Part: TSPL CustomerDetailsPost]
Lines : TSPL CustomerDetailsPost
Repeat: TSPL CustomerDetailsPost : Ledger
Scroll: Vertical
[Line: TSPL CustomerDetailsPost]
Fields : TSPL Customer Led No, TSPL Customer Led Name
JSONTag : “Customer Details”
Explode : TSPL Customer Led Bal
[Part:TSPL Customer Led Bal]
Line : TSPL Customer Led CB
JSONTag : “Led Balances”
[Line: TSPL Customer Led CB]
Field : TSPL Customer Led OB, TSPL Customer Led CB
Repeat : TSPL Customer Led CB
JSON Tag As Desc Name: No
Explanation
| Default JSON Output | JSON Output when JSON Tag as Desc Name : NO in line TSPLCustomerLedCB |
|
{ “Customer Details”: [ { “Customer No.”: “1”, “Customer Name”: “Akshaya Enterprises”, “Led Balances”: { “tsplcustomerledcb”: { “Customer Opening Balance”: 1000.00, “Customer Closing Balance”: [ -1033.00 ] } } }, { “Customer No.”: “2”, “Customer Name”: “Arobine Party”, “Led Balances”: { “tsplcustomerledcb”: { “Customer Opening Balance”: 0, “Customer Closing Balance”: [ 0 ] } } } ] } |
{ “Customer Details”: [ { “Customer No.”: “1”, “Customer Name”: “Akshaya Enterprises”, “Led Balances”: { “Customer Opening Balance”: 1000.00, “Customer Closing Balance”: [ -1033.00 ] } }, { “Customer No.”: “2”, “Customer Name”: “Arobine Party”, “Led Balances”: { “Customer Opening Balance”: 0, “Customer Closing Balance”: [ 0 ] } } ] } |
In this example, the function TSPL CustomerDetailsPost when called, exports the report TSPL CustomerDetailsPost in JSON format (JSONEx version) to a file LedgerReport.json. The structure of the JSON output given by the report structure. The line TSPL CustomerDetailsPost repeats over collection Ledger in part TSPL CustomerDetailsPost, which further explodes the part TSPL Customer Led Bal. The JSON Tag attribute mentioned in the part line and field creates corresponding tag in the output. With the mention of the attribute JSONTagAsDescName set to No in the line TSPL Customer Led CB, the corresponding tag for this line doesn’t come in the JSON output of the report.
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.
NOTE: 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.
Syntax
[Form/Part/Line/Field: <Definition Name>]
JSON Tag : <String Expression>
[Form/Part/Line/Field: <Definition Name>]
XML Tag : <String Expression>
<Definition Name> – the name of the definition.
< String Expression> – any expression which evaluates to a string.
Example
|
JSON or JSONEx [Function: TSPL Ledger Export] ;; set SVExportFormat to $$SysName:JSON for report output in older ;; JSON format 00: Set : SVExportFormat: $$SysName:Jsonex 01: Set : SVPrintFileName : “.\Export\LedgerReport.json” 02: Export: TSPL Ledger List : Yes :Yes [Report: TSPL Ledger List] [Form: TSPL Ledger List] Part: TSPL Ledger Part JSON Tag: “Envelope” [Part: TSPL Ledger Part] Lines : TSPL Ledger Line Repeat : TSPL Ledger Line : Ledger Scroll : Vertical JSON Tag: “Ledger List” [Line: TSPL Ledger Line] Fields : TSPL Led Name JSON Tag: “Ledgers” [Field: TSPL Led Name] Use : Name Field Set as : $Name JSON Tag: “Ledger Name” |
XML [Function: TSPL Ledger Export] 00: Set : SVExportFormat: $$SysName:XML 01: Set : SVPrintFileName : “.\Export\LedgerReport.xml” 02: Export: TSPL Ledger List : Yes :Yes [Report: TSPL Ledger List] [Form: TSPL Ledger List] Part: TSPL Ledger Part XML Tag: “Envelope” [Part: TSPL Ledger Part] Lines : TSPL Ledger Line Repeat : TSPL Ledger Line : Ledger Scroll : Vertical XML Tag: “Ledger List” [Line: TSPL Ledger Line] Fields : TSPL Led Name XML Tag: “Ledgers” [Field: TSPL Led Name] Use : Name Field Set as : $Name XML Tag: “Ledger Name” |
Explanation
| 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” } ] } } |
This is the attribute that gives a simple line multiple powers to perform number of actions, by associating key definitions with the line. This also gives hidden powers to the UI like when you press Shift+Enter on the voucher line, that line explodes. Unlike a button a key is not visible to the user on the screen, but still does the job when the keys are pressed. In short, the attribute key makes a simple line into a super line!
Syntax
Key : <Key Definition Name>
<Key Definition Name> is the name of the key definition
Example
[Line : TSPL Voucher Line]
Field : TSPL Voucher Number
Key : Line Object Display AltEnter
[Key: Line Object Display AltEnter]
Key : Alt + Enter
Action: Display Object
Mode : Display
Explanation
The example shows that the line TSPL Voucher Line is associated with a key Line Object Display AltEnter via the Key attribute which displays the voucher object associated with the selected line or line in focus, in display mode.
This is a wonderful attribute to creating group lines, i.e. creating line/lines within a line. Especially useful when you want to repeat group of lines, instead of a single line. This way all the lines in the group will be associated with an object and data can be represented within multiple lines.
Note that line can have either fields or lines, not both.
Syntax
Line: < Line Definition Name>
<Line Definition Name> is the name of the line definition.
Example
[Part: TSPL Line Sample]
Line : TSPL Line in Line
Repeat:TSPL Line in Line : Stockitem
[Line:TSPL Line in Line]
Line: TSPLName, TSPLAmount
[Line: TSPLName]
Field: Namefield
Local: Field: NameField : Set as: $Name
[Line: TSPLAmount]
Field: AmountField
Local: Field: AmountField : Set as: $ClosingValue
Explanation
The line TSPLLineInLine has 2 lines TSPLName, TSPLAmount and it repeats over collection Stockitem in the part TSPL Line Sample . Line TSPLName shows the Name of stock item and line TSPLAmount shows the closing value.
This attribute is a wonderful code organizer that helps you to read and analyse code better. This has no end user implication, but it sure is a developer’s friend.
Whenever any line attribute houses a complex expression, this attribute can be used to a meaningful label to the expression and use the label to access the expression instead. Makes the code look clean and helps reuse the same label across attributes if need be. And this label which is called a local formula can be used only locally in the context of the current line only where it is defined its value is accessed with @ symbol.
Note that its advised having labels that don’t match any attribute names just to avoid confusion. Also, this local formula can be used only within this Line context, even the fields or lines within the line cannot access it.
Syntax
Local Formula : <Formula Name/Label> : <Expression>
OR
<Formula Name/Label> : <Expression>
<Formula Name/Label>: is a user defined name
<Expression>: Any expression that the local formula needs to be assigned
Example
[Line: TSPL Line Sample]
Field: TSPL Line Fld1, TSPL Line Fld2
Local Formula: LineLF: $Name contains “StockItem”
Option: Border1 : @LineLF
Option: Border2: NOT @LineLF
Explanation
The example shows the local formula LineF is used in the condition of Optional lines, to check if Name contains the text ‘Stockitem’. With this, the condition is written just once in the local formula and used anywhere in the line any number of times.
When you are printing a report, TallyPrime automatically decides how many lines fit in a page and accordingly moves content to subsequent pages. But it still gives you the control to decide under what condition, the lines should be moved to the subsequent pages with this attribute. Thus, giving the flexibility to choose how much content should be shown in a page.
Syntax
Next Page : <Logical Expression>
<Logical Expression> is the logical value or expression that evaluates to a logical value.
Example
[Line : TSPL Vch Explosion]
Next Page : NOT $$DoExplosionsFit
Explanation
When the exploded parts of the line do not fit the current page, content from that line onwards is moved to the subsequent page in the print, as specified by the attribute Next Page.
When a line is repeated, by default cursor is shown when you scroll through them in the report. But, especially in create or alter mode, you might not want the want to scroll through the fields and lines without the appearance of the cursor. That is where this attribute helps. It helps to set the condition on which cursor should not appear on the line. Whether it is to provide a more elegant design or to bring more focus to the data entry of the fields, you can use this attribute to help the cause.
Syntax
No Cursor : <Logical Expression>
<Logical Expression> is the logical value or expression that evaluates to a logical value.
Example
[Part: TSPL Part]
Line : TSPL Line
Repeat: TSPL Line: StockAgrr
Scroll: Vertical
[Line: TSPL Line]
Field: TSPL Field
No Cursor: Yes
Explanation
The example shows a line TSPL Line repeating on an aggregate udf, and the line is set with attribute No Cursor:yes. So the line will not have a cursor while user enters the field values.
This attribute is like a secret box where a lot of work goes on but for a user it just feels like a simple interaction. Be it to set a variable when cursor focuses on the line or call a function to update certain values when on a condition related to the line object, this attribute does it all. The ON attribute lets you define a list of actions that should automatically run when a specific event takes place — making your application smarter and more responsive.
Syntax
On: <Event>: <Logical Condition>:<action>
<Event> The event keyword that acts as a trigger for the action to take place
<Logical Condition> : Condition on which needs to be satisfied along with the event for the action to take place
<action> The action that needs to be executed
Example
[Line: TSPL Left Line Info]
Fields : TSPL Left Field1, TSPL Left Field2
On : Focus : Yes : SET : VariableCurLineNumber : $$Line
Explanation
The example shows that with the specification of the On attribute in the line TSPL Left Line Info, the variable VariableCurLineNumber is set with the line number as soon as the line receives focus.
This attribute gives the power to choose multiple paths when the condition for each path is satisfied. This attribute is used extensively in TallyPrime to define properties of the line based on a condition and to top it off, multiple option statements can be defined for the same line. Evaluates the conditions for all the options provided in the description code and applies all the option statements which satisfy the evaluation conditions. For example, let’s say if a certain condition satisfies, the line border should be ThinBottom, when another condition satisfies the line should be indented by 2 points. At a point when both the condition gets satisfied you will get a line indented by 2 points with border ThinBottom.
Note that the line definition mentioned in the option statement should be defined with the modifier ‘!’ to indicate it is a optional line.
Syntax
Option : <Optional Line Definition Name> : <Logical Condition>
<Option Line Definition Name> is the line definition where the attributes given gets applied to the original line when the condition is satisfied
<Logical Condition> is a logical value or an expression that evaluates to a logical value
Example
[Line: TSPL Line Sample]
Field: TSPL Line Fld1, TSPL Line Fld2
Local Formula: LineLF: $Name contains “StockItem”
Option: TSPL Border1 : @LineLF
Option: TSPL Border2 : NOT @LineLF
[!Line: TSPL Border1]
Border: Thin Bottom
[!Line: TSPL Border2]
Border: Thick Bottom
Explanation
Here the local formula LineF is used in the condition of Optional lines. When the condition in the local formula evaluate to true, the properties of optional line TSPL Border1 is applied, when it is false, properties of optional line TSPL Border2 is applied to the line TSPL Line Sample.
Whenever a document spans across multiple pages, it needs to have some info to bridge the information from one page to another and say that there is more to come in further reading. This is where this attribute plays its part. Applicable only when a report is printed.
A Page Break is simply the point where one-page ends and the next page begins. Handling page breaks properly is important because the current page should show that the content continues in the next page, and the next page should also indicate that it’s a continuation from the previous one. So basically, you need two things: a closing identifier (closing page break info) and an opening identifier (opening page break info).
In other words, page breaks help define what gets printed in the headers and footers across multiple pages. A Closing Page Break starts from the first page and gets printed on every page except the last one—for example, something like “Continued…” at the bottom of each page. An Opening Page Break starts from the second page and continues till the last page. Also, the Closing Page Break is always given before the Opening Page Break, because the closing page break is naturally encountered first.
In TDL, page breaks can be handled both vertically and horizontally. Page breaks can also be defined in form and Part which handles vertical page breaks – In cases where a report containing data cannot be printed in a single page, one needs to use vertical page breaks like printing Continued… at the end and printing company name and report name in subsequent page beginning.
Horizontal page breaks can be specified at Line through Line Attribute Page Break. It is generally used to repeat a closing column at every closing page and opening column at every opening page. It takes 2 parameters, viz. 1st Field for Closing Page Break & 2nd for Opening Page Break.
Syntax
Page Break : <Closing Field Definition Name>, <Opening Field Definition Name>
<Closing Field Definition Name> is the field definition name used as closing page break
<Opening Field Definition Name> is the field definition name used as opening page break
Example
[#Line : DSP ColVchDetail]
Page Break : Cl Page Break, Op Page Break
[Field : Cl Page Break]
[Field : Op Page Break]
Fields : DBC Fixed, VCH No
Explanation
Consider a Columnar Sales Register Report of a company, where multiple columns are printed across pages. Some fixed columns are required in subsequent pages which makes it easy to map the columns in subsequent pages.
In this example, Line DSP ColVchDetail is modified and closing and opening page breaks are adding via the attribute Page Break. the Field Cl Page Break is defined as Empty, since no Closing Column or Field is required and. Field Op Page Break is defined with further fields DBC Fixed and VCH No, which are available in default TDL
When you are printing a report or an invoice on a preprinted stationary, it is important to mention which are the content that is already printed in the paper and hence they need to be omitted from printing, so that the print on the paper is neat and clean. That is what this attribute does. When the Preprinted attribute is set to YES, the contents of the current line will be left blank assuming the same to be pre-printed.
These attributes work in conjunction with ‘preprinted/ plain’ button in the Print Configuration screen, which sets the variable SVPreprinted to yes informing the system that print is going to happen on a pre-printed paper.
Syntax
Preprinted : <Logical Condition>
<Logical Condition> is a logical value or an expression that evaluates to a logical value
Example
[Line : TSPL Company Name]
Fields : TSPL Company Name
Border : Thin Bottom
Preprinted : Yes
Preprinted Border : yes
Explanation
The example shows that, attributes Preprinted and Preprinted Border both are enabled in the line TSPL Company Name. As a result, the company name is omitted from printing and so is the border thin bottom. But the space occupied by the line content and border is left blank while printing the report to which the line belongs, assuming that they are already printed in the paper.
Like the preprinted attribute, when the ‘Preprinted Border’ attribute is set to YES, the borders used in the Line will be assumed to be pre-printed and will be omitted from getting printed.
This attribute work in conjunction with ‘preprinted/ plain’ button in the Print Configuration screen, which sets the variable SVPreprinted to yes informing the system that print is going to happen on a pre-printed paper.
Syntax
Preprinted Border: <Logical Condition>
<Logical Condition> is a logical value or an expression that evaluates to a logical value
Example
[Line : TSPL Company Name]
Fields : TSPL Company Name
Border : Thin Bottom
Preprinted : Yes
Preprinted Border : yes
Explanation
The example shows that, attributes Preprinted and Preprinted Border both are enabled in the line TSPL Company Name. As a result, the company name is omitted from printing and so is the border thin bottom. But the space occupied by the line content and border is left blank while printing the report to which the line belongs, assuming that they are already printed in the paper.
It’s always nice when you can see and get only what’s relevant to you isn’t it? That’s what this attribute helps with. When list of information is shown in a report, it is always possible that when a user sees the report, user wants to see only relevant information. For example, when I see a stock report, I do not want to see stock items with no opening balance and closing balance. So, in this case I would remove the lines showing stock items with zero balances.
This attribute takes a logical expression based on which the line should be removed. The difference between this attribute and ‘Empty If’ attribute is that, while both remove the line from the UI, in case of remove if, even if the line appears to be removed from the UI, it still participates in the part total. That is one of the reasons this attribute is used to remove lines with objects showing zero balances.
Syntax
Remove : <Logical Expression>
<Logical Expression> is a logical value or expression that evaluates to a logical value
Example
[Line: TSPL Line Sample]
Field : TSPL Line Fld1, TSPL Line Fld2
Remove if: $$IsEmpty:$ClosingValue
Explanation
The example shows that with the specification of the Remove If attribute in the Line TSPL Line Sample, the lines where closing value is zero will be removed from the UI.
This attribute is the heart of columnar and auto columnar reports in TallyPrime, which allows the fields to repeat horizontally, hence giving rise to columns. Instances of the same field are created in these repetitions. Now there are 3 ways in which the repetitions can happen based on the requirement.
- Repeat over a collection. Here the number of repetitions is same as number of objects in the collection. Each instance is associated with each object of the collection in order.
- Repeat the field and set the number of repetitions using the ‘Set’ attribute.
- Repeat the field and determine the number of repetitions, it internally uses the repeat behaviour of the Report and Variable. This is used in the case of columnar and auto columnar report.
Note that in a line only 1 field can be repeated and when repeat attribute is used in a line, Right Field attribute cannot be used as by default, the Repeat Attribute places the Field specified to the Right of the Screen/Page.
Syntax
Repeat : <Field Name> [: <Collection Definition Name>]
<Field Name> is the name of the Field to be repeated.
<Collection Definition Name> is the name of the collection on which the Field is repeated. It is optional.
Example
[Line : TSPL CFBK Rep Details]
Fields : TSPL CFBK Rep Name , TSPL CFBK Rep Party
Repeat : TSPL CFBK Rep Party : TSPL CFBK Party
[Field : TSPL CFBK Rep Party]
Use : Qty Primary Field
Set as : $$ReportObject:$$CollectionFieldByKey:$BilledQty:@SKFormula:TSPLCFBKSummVoucher
SKFormula : $PName + #TSPLCFBKRepName
Explanation
The example shows that, in the Line TSPLCFBKRepDetails the Field TSPL CFBK Rep Party is repeated over the Collection TSPL CFBK Party. The Field TSPL CFBK Rep Party is the intersection between rows & columns. The value is gathered from the Collection TSPL CFBK Summ Voucher using the function $$CollectionFieldByKey, where the Index Key in the current context is passed as a parameter. “$PName” in the current object context returns the Party Name. Similarly, the Field Value #TSPLCFBKRepName in the current context returns the Stock Item Name. Hence, the Search Key Index “Party Name + Stock Item Name” for every Intersection point is passed to this function, which extracts and returns the corresponding Quantity from the Collection.
Have you seen how in many of the reports like stock summary, name field aligned to the left of the line while the details like quantity, amount fields are aligned to the right side of the line? Let’s see how that’s done! In the hierarchy of the report structure, Line contains fields and which side of the report the fields are placed, determines how the information is placed and read in the report. That is where this attribute plays its part. Apart from specifying that given fields belong to this line, this attribute aligns the fields to the right side of the line, unlike the attribute Field or Left Field which aligns the fields to the left side of the line.
Note that, if Repeat Attribute is used in a Line, specification of Right Fields is not allowed, as by default, the Repeat Attribute places the Field specified to the Right of the Screen/Page.
Syntax
Right Fields : <Field1, Field2, ….>
<Field1, Field2, ….> are the field definition names
Example
[Line: TSPL Stock Line]
Field : TSPL StockName
Right Field: TSPLStockQty, TSPLStockVal
Explanation
The example shows that the Field TSPLStockName specified via the attribute Field is aligned to the left end of the line TSPL Stock Line and TSPLStockQty, TSPLStockVal specified via attribute Right Field is aligned to the right end of the line.
Have you witnessed how you can select lines in a report say daybook and perform several actions? Like, you can remove line, delete selected vouchers and so on. That makes the action of selection itself a very important property of the line. A report can have multiple lines, some may be repeated, some not. And by default, a repeated line is selectable i.e. this attribute is set to yes by default and a non-repeated line is not selectable i.e. this attribute is set to No by default. This attribute comes into picture when you want to change this default behaviour. You can define the condition on which the line (or lines within the line) can be selectable or not. Whether it is to omit a line from being selectable so that it is excluded from actions performed on selectable lines, or to include a non-repeated line to be selectable to perform certain actions, this attribute lets you have the selectable property of the line under your control.
Note that the value is also inherited from Parent Part/Line, and the same can be overridden at Line level.
Syntax
Selectable:<Logical Expression>
<Logical Expression> is a logical value or an expression that evaluates to a logical value.
Example
[Line: TSPL Vch Line]
Field : TSPL Vch Date, TSPL Vch Type, TSPL Vch Amount
Selectable: Not $IsOptional
Explanation
Here the line TSPL Vch Line repeats over voucher collection (not shown in the code) and only non-optional voucher lines can be selectable, while the optional ones cannot be, as specified by the line attribute Selectable.
A field can be repeated in a report to generate columns. When you either repeat the field over a collection or repeat to generate columnar or auto columnar report, the number of repetitions is dynamic in nature. But, if you know the field must be repeated for a set number of times, then this attribute come handy. For example, you are building a solution where a product takes exactly 3 price variations. So, you can use this attribute and set the number to 3. To use this attribute, just repeat the field using Repeat attribute and specify the number of repetitions using the Set attribute.
Note that this attribute works only when the field is just repeated but not repeating on a collection.
Syntax
Set:<Number Expression>
<Number Expression> is a number or an expression that evaluates to a number.
Example
[Line: TSPL Student Line]
Field : TSPL Student Name, TSPL Student Merit
Repeat : TSPL Student Merit
Set : 3
Explanation
The example shows that the field TSPLStudentMerit is repeated 3 times in the line TSPL Student Line as specified by the attribute Set.
Want to add some spacing in terms of rows in the excel export of your report? This is your attribute that will make it happen. Simply specify the number of rows that needs to be skipped / left blank before printing the line in the excel file. For example, if you specify SkipRows: 3 in the line, then the line content is printed in the excel export after 3 leaving 3 rows blank. If it’s specified in a repeated line, then every repetition will have the specified number of rows left blank before it. Whether it is to adhere to a specific excel export format spacing or to just add some spacing in the export to make data easier to read, this attribute will do it for you.
Syntax
Skip Rows:<Number Expression>
<Number Expression> is a number or an expression that evaluates to a number.
Example
[Line: TSPL Student Line]
Field : TSPL Student Name, TSPL Student Merit
Skip Rows: 1
Explanation
The example shows that when the report to which the line TSPL Student Line, is exported in excel format, the line gets exported after leaving a blank row above as specified by the attribute Skip Rows.
Having neat and clear sections in a report makes it an easily consumable one. And spacing plays an important role in making that happen. This attribute Leaves specified space below the lines content, thus creating a clear separation between the line and the neighbouring content. This space is inclusive within the Height of the specific Part in which the current Line Definition resides. If the Height of the Part is unable to accommodate the same, it compresses the line to fit it within the available Height.
Syntax
Space Bottom : <Measurement Formula>
<Measurement Formula> is used to specify the space in a specified unit of measurement.
A Unit of Measurement can be any of the following:
- Millimeters/mms
- Centimeters/cms
- Inch(es)
- Number of Characters/Number of Lines
- % Screen/Page
- Number – Points (where 1 Point = 1/72 Inch)
Example
[Line: TSPL Student Line]
Field : TSPL Student Name, TSPL Student Merit
Space Bottom : 2
Space Top : 1
Explanation
The example shows that the content of the line TSPL Student Line will be shown after leaving space of 1 line in the top and 2 lines in the bottom, as specified by the attributes Space Top and Space Bottom.
A visually appealing report needs to have information presented in a clean and structured format. And spacing plays an important role in making that happen. This attribute Leaves specified space above the lines content, thus creating a clear separation between the line and the neighbouring content. This space is inclusive within the Height of the specific Part in which the current Line Definition resides. If the Height of the Part is unable to accommodate the same, it compresses the line to fit it within the available Height.
Syntax
Space Top : <Measurement Formula>
<Measurement Formula> is used to specify the space in a specified unit of measurement.
A Unit of Measurement can be any of the following:
- Millimeters/mms
- Centimeters/cms
- Inch(es)
- Number of Characters/Number of Lines
- % Screen/Page
- Number – Points (where 1 Point = 1/72 Inch)
Example
[Line: TSPL Student Line]
Field : TSPL Student Name, TSPL Student Merit
Space Bottom : 2
Space Top : 1
Explanation
The example shows that the content of the line TSPL Student Line will be shown after leaving space of 1 line in the top and 2 lines in the bottom, as specified by the attributes Space Top and Space Bottom.
Do you have a widely spaced columnar report where relating data columns feels like a hassle because of too much information in one report? How about distinguishing the rows with stripes on alternate rows? Makes the data much more relatable isn’t it. The Stripe View feature allows users to easily relate data across widely spaced columns without moving the cursor to each line. To enable this feature, TDL attribute called Stripes is introduced within the Report, Form, Part, and Line definitions.
If you enable the master configuration (Help > Settings > Display > Enable stripes view for report: Yes) and use scrolling in the report, you don’t need to manually apply the Stripes attribute at the Report, Form, Part, or Line level. The report automatically displays in stripe view. But, in this case you can set stripe attribute to No if you do not want the report to have the stripe view.
However, if you do not use scrolling in the report, you must apply the Stripes attribute at the Report, Form, Part, or Line level based on your specific requirements.
When Stripe view is enabled, following are the behaviours that applies to the Line.
Stripes Automatically Apply to Lines
- Repeated Lines with Scroll: The system automatically applies stripes to lines when scroll is enabled.
- Simple Lines with Scroll (Fixed: No): The system automatically applies stripes to simple lines when scrolling is enabled, and they are not marked as fixed.
Stripes Do Not Automatically Apply to Lines
- Simple Lines: Without scroll, the system does not apply stripes by default.
- Repeated Lines Without Scrolls: The system does not apply stripes to repeated lines without scrolling.
- Fixed Lines: The system does not apply stripes to lines marked as fixed.
Stripes Do Not Automatically Apply to Parts
- Fixed Parts: When you mark parts as fixed, the system does not apply stripes. It excludes parts and lines associated with fixed parts from the stripe view.
Stripes Do Not Automatically Apply to Empty Lines
- Lines Associated with Empty Objects: The system does not apply stripes to lines linked to empty objects, as opposed to master objects.
- Fixed Fields: The system does not include fields marked as fixed in stripes.
Additional Notes
- You can set the Fixed attribute at the Part, Line, and Field levels. When you mark Parts and Lines as fixed, they follow the behaviour concerning stripes as mentioned above. When you mark a Part or Field as Fixed, the platform internally sets the associated Line as fixed.
- The platform processes the Fixed attribute for Fields after processing the Lines. As a result, it internally sets a Line’s Fixed status after the explosion of the Part mentioned in the Line. Before drawing and during Line processing for stripes, if you consider a Line as fixed, the platform does not include the exploded Part and its Lines in the Stripe View by default.
- Due to this, if you need the exploded Part and its Lines included in the Stripe View, you must explicitly set the Part using the Stripes attribute.
Syntax
Stripe:<Logical Expression>
<Logical Expression> is a logical value or an expression that evaluates to a logical value
Example
[Line: TSPL Details]
Field : TSPL Field
Stripe: No
Explanation
The example shows that with the attribute Stripe set to No in the line TSPL Details, the stripe view is disabled for the lines even if it is enabled in the Help ->Settings -> Display in the TallyPrime product
This attribute helps apply different field behaviors based on grouped conditions—like Option, but smarter and faster, as it reduces code complexity and improves the performance.
The modifier Option compulsorily evaluates the conditions for all the options provided in the description code and applies all the option statements which satisfy the evaluation conditions. This means that it is not easy to write the code where you just want one of the options to be applied. You must make sure that other options are not applied using a negative condition.
The attribute modifier ‘Switch’ has been provided to support these types of scenarios, where evaluation is carried out only up to the point where the first evaluation process has been cleared.
Apart from this, Switch statements can be grouped using a label. Therefore, multiple switch groups can be created and the first switch case that satisfies the condition would be applied from each group.
Note that the line definition mentioned in the option statement should be defined with the modifier ‘!’ to indicate it is a optional field.
Syntax
Switch : <Label> : <Optional line Name> : <Condition>
<Option line Name> is the Optional line definition name
<Logical Condition> is a logical value or an expression that evaluates to a logical value
Example
[Line: TSPL Company Name]
Field : TSPL Company Name
Switch: Case Border : TSPLLineThinBorder: ##LineThinBorder
Switch: Case Border : TSPLLineTickBorder: NOT ##FieldThinBorder
Switch: Case Space : TSPLLessSpace: ##LineLessSpace
Switch: Case Space : TSPLMoreSpace: NOT ##LineLessSpace
[!Line: TSPLLineThinBorder]
Border : ThinBox
[!Line: TSPLLineThickBorder]
Border : ThickBox
[!Line: TSPLLessSpace]
Space Top : 0.5
Space Bottom : 0.5
[!Line: TSPLMoreSpace]
Space Top : 3
Space Bottom : 3
Explanation
The line TSPL Company Name shown has border and spacing determined with switch statements where the Border is determined in the switch group Case Border and spacing in switch group Case Space. In the switch group Case Border, when the value of the variable LineThinBorder evaluates to true, the Border specified in the optional line TSPLLineThinBorder gets applied else that of the optional line TSPLLineThickBorder gets applied. In the switch group Case Space, when the value of the variable LineLessSpace evaluates to true, the Space attributes specified in the optional line TSPLLessSpace gets applied else that of the optional line TSPLMoreSpace gets applied.
This attribute is related to defining structure of the XML output of a Report. It could be when the report is exported into a file using the native export utility of TallyPrime or through function by setting variables SVExportFormat to XML and file name in SVPrintFileName and using Export action or by sending XML request to TallyPrime for the report. Refer to these in details in their specific pages.
An XML structure has XML tag, XML attribute and the value corresponding to XML tag . This attribute defines the XML attribute that should be present in the XML output corresponding to the line.
For example, if a line needs to produce this <Customer TYPE:Name> in the XML output, then ‘XML tag’ attribute will be set with ‘Customer’, ‘XML Attr’ attribute will be set with ‘TYPE:Name’.
Note that more than one XMLAttr attribute can be given in the same line.
Syntax
XMLAttr : < Expression for Name> : <Expression for Value>
<Expression for Name>In the Name value pair of XML attribute, this is an expression that evaluates to a string that should be shown as the name of the xml attribute
<Expression for Value> In the Name value pair of XML attribute, this is an expression that evaluates to a string that should be shown as the value of the xml attribute
Example
[Line: TSPL Led]
Field : TSPLLed
XML Tag : “Customer”
XML Attr: “TYPE”:”Name”
Explanation
When the report to which the Line TSPL Led is exported in XML format, the corresponding XML tag for the line is <Customer TYPE:Name> in the XML output of the report as specified by the attributes XML Tag and XML Attr.
