# Tally TDL Report Template

> Source: https://netray.co/tools/tally-tdl-report-template
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Generate a starting TDL file with a menu item, collection and report layout so you can customise Tally Prime reports faster.

## Category

developer

## Erp

Tally Prime

## Region

India

## Audience

- Tally developer
- Tally consultant
- Accountant
- ERP admin

## Tool

**Kind:** template

**Output:** code

**Language:** text

**Fields:**

#### Report name

**Key:** report_name

**Type:** text

**Default:** Netray Stock Report

**Help:** Shown as the report title

#### Menu key letter

**Key:** menu_key

**Type:** text

**Default:** K

**Help:** Shortcut letter shown in the Gateway of Tally

#### Collection name

**Key:** collection

**Type:** text

**Default:** NetrayStockColl

#### Object type

**Key:** object_type

**Type:** select

**Options:**

- Stock Item
- Ledger
- Voucher

**Default:** Stock Item

#### Fetch fields

**Key:** fetch_fields

**Type:** text

**Default:** Name, Parent, ClosingBalance, ClosingValue

**Blocks:**

#### Menu entry and report

**Body:** [#Menu: Gateway of Tally]
    Add : Key Item : {{report_name}} : {{menu_key}} : Display Collection : {{collection}}

[Collection: {{collection}}]
    Type : {{object_type}}
    Fetch : {{fetch_fields}}
    Title : "{{report_name}}"

[Report: {{collection}}Rpt]
    Form : {{collection}}Frm
    Title : "{{report_name}}"

[Form: {{collection}}Frm]
    Parts : {{collection}}Part

[Part: {{collection}}Part]
    Lines : {{collection}}Title, {{collection}}Line
    Repeat : {{collection}}Line : {{collection}}
    Scroll : Vertical

[Line: {{collection}}Title]
    Use : Name Field
    Local : Field : Name Field : Set as : "Name"

[Line: {{collection}}Line]
    Fields : NameFld, ParentFld, BalFld, ValFld

[Field: NameFld]
    Use : Name Field
    Set as : $Name

[Field: ParentFld]
    Use : Name Field
    Set as : $Parent

[Field: BalFld]
    Use : Number Field
    Set as : $ClosingBalance

[Field: ValFld]
    Use : Amount Field
    Set as : $ClosingValue

#### Loading the file

**Body:** 1. Save the text above as a file with a .tdl extension, for example NetrayStockReport.tdl.
2. In TallyPrime open Help, then TDL and AddOn, and add the file path.
3. Set Load TDL on startup to Yes if it should persist.
4. Open the Gateway of Tally and look for the menu entry named {{report_name}}.

**Notes:** This is a skeleton to learn from and adapt, not production code. TDL syntax, field names and object attributes vary with the object type chosen and with the Tally Prime release. Test only on a copy of the company, keep a backup, and check the official TDL reference for your version. Tally Solutions documents TDL; this tool is not affiliated with them.

## Content

**Intro:** TDL, the Tally Definition Language, lets you add reports, fields and menus to Tally Prime without touching the product itself. This generator produces a clean starting file with a menu entry, a collection and a simple report, so you can learn the structure and edit it for your own case.

**Sections:**

#### How to use the generator

**Body:** Fill in the report name, the menu key, a collection name without spaces, the object type and the fields to fetch. The code panel updates as you type. Copy it into a text file with a .tdl extension, load it in Tally Prime and open the new menu entry. Change fields and layout in small steps and reload after each change so you can see which edit broke what.

#### How a TDL report is structured

**Body:** A TDL report is built from nested definitions. A menu opens a report, a report uses a form, a form has parts, parts have lines, and lines hold fields. A collection supplies the data objects, such as stock items or ledgers, and fields read attributes using the dollar sign, for example the name or closing balance.

**Bullets:**

- Menu: adds the entry to the Gateway of Tally
- Collection: chooses the object type and fetched attributes
- Report, Form, Part, Line: define the layout
- Field: shows one attribute of each object

#### Extending the template

**Body:** Add filters to the collection to show only items below a reorder level or in a chosen group. Add a total field in the part to sum values. Use a second collection to show voucher detail. When an attribute is not available on the object you chose, you need to fetch a related object or compute the value with a function. Read the reference for your Tally Prime release before using unusual attributes.

#### Common mistakes

**Body:** Common issues are misspelt definition names, a missing Fetch for an attribute you display, mixing tabs and spaces carelessly, and loading a file that has a syntax error so nothing appears. Another is editing the live company without a backup. Keep each TDL small, name definitions with a prefix of your own, and keep a changelog for every file you deploy to clients.

**Cta:** If you are hitting the limits of what TDL can reasonably do, Netray can help you move reporting to a governed layer over your data or to an ERP with a proper reporting engine.

**Faq:**

#### What is TDL in Tally?

**Answer:** TDL stands for Tally Definition Language. It is the language used to define Tally's own screens and reports, and it lets consultants add custom fields, reports, menus and validations without changing the core product.

#### How do I load a TDL file in Tally Prime?

**Answer:** Save the file with a .tdl extension, open the TDL and AddOn setting from the Help menu, add the file path, and enable loading. Restart or reload the company if the new menu does not appear.

#### Can TDL change my data?

**Answer:** TDL can add validations and automations, and poorly written code can affect voucher entry. Test on a copy of the company, keep backups, and review any TDL from third parties before using it on live data.

#### Do I need a developer to write TDL?

**Answer:** Simple reports can be adapted by an accountant who reads the code carefully. Complex customisations are better handled by a TDL developer, since mistakes may be hard to see until month end.

## Search terms

tally tdl report template, tally tdl sample code, tally tdl custom report, tally prime tdl example, tally tdl collection example, how to write tdl in tally, tdl menu add item, tally custom report stock items

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
