Table of Contents

 

Resource

Applications often require external resources such as document templates, images, icons, cursors, or other files to enhance the user interface or support document generation. Resource is a definition used to register and access such external resources from within TDL. A resource can reside on the local file system, be accessed over HTTP or FTP, or be embedded within a DLL or EXE. Once defined, the resource can be referenced by various TDL attributes, such as the Resource attribute at the Form level for template-based printing and exporting, or by other definitions that require external files. Depending on the type of resource, it can be used to generate documents, display images, apply icons or cursors, or provide other reusable assets within the application. TDL supports various resource types, including document templates and image formats such as BMP, JPEG, ICO, and CUR, allowing developers to separate external assets from application logic and reuse them across multiple definitions. 

Attributes

Applications often use reusable assets such as document templates, images, icons, logos, cursors, and other external resources. Resource is an attribute used within a Resource definition to specify the name or identifier of the resource that should be accessed. The resource may be available within the running Tally application or embedded inside an external DLL or EXE. Along with the Resource Type attribute, it enables TDL to identify, interpret, and use the required resource, such as a document template, image, icon, or cursor. Once defined, the resource can be referenced from other TDL definitions, such as Forms and Parts, allowing the same asset to be reused across the application without duplication. 

Unlike the Source attribute, which specifies the physical path of an external file, the Resource attribute identifies a resource by its name or identifier when it is embedded within an application, DLL, or EXE. In simple terms, use Source when the asset exists as a standalone file, and use Resource when the asset is already packaged inside another application or library.

Syntax

[Resource: TSPL Resource_Name] 

Resource               : <Name Of Resource> : [<DLL/EXE Name with path>] 

Resource  Type   : <Format Type> 

Example

[Resource: TSPL Smp Other Appl as Resource] 

Resource      : “102” : “Images\Everything.Exe” 

Resource Type : BMP 

Explanation

In this example, the Resource definition TSPL Smp Other Appl as Resource identifies a bitmap image embedded within the external executable Everything.exe. The Resource attribute specifies the resource identifier 102 along with the path to the executable that contains the resource, while the Resource Type attribute indicates that the embedded resource is a BMP image. When this Resource definition is referenced from another TDL definition, such as a Part or Form, the system retrieves the bitmap image with the identifier 102 from Everything.exe and makes it available for use. This demonstrates how the Resource attribute can be used to access resources that are packaged inside an external application instead of loading them from standalone files.

A Resource definition can represent different types of assets, such as images, document templates, fonts, scripts, or other external resources. Resource Type is an attribute used to specify the type of resource being referenced. It informs TallyPrime how the associated resource should be interpreted, loaded, and used at runtime. Specifying the correct resource type ensures that the system processes the resource appropriately, whether it is displayed as an image, used as a document template for printing or exporting, rendered as a web asset, or loaded for another supported purpose. Since the Resource attribute identifies the resource to be accessed, the Resource Type attribute is mandatory in every Resource definition to enable Tally to interpret and use that resource correctly. 

Following are the permissible values 

Resource Type 

Purpose 

Typical Usage 

BMP, GIF, JPEG, PNG, ICON, CURSOR 

Images and graphical resources 

Display logos, icons, toolbar images, cursors, backgrounds, or other visual elements in Forms and Parts. 

WORDXML, MSEXCEL, ODT, ODS 

Document templates 

Generate formatted documents or spreadsheets during printing and export using Productivity Suite capabilities. 

XML, JSON 

Structured data templates 

Generate XML or JSON-based exports for integrations, data exchange, or APIs. 

JSONSCHEMA 

JSON validation schema 

Define the structure and validation rules for JSON documents during generation or processing. 

HTML, CSS, JAVASCRIPT 

Web resources 

Render HTML content and apply styling or client-side scripting for browser-based interfaces or embedded web views. 

TTFFONT 

Font resources 

Use custom TrueType fonts while rendering or printing documents. 

TSF 

Tally Structured File 

Store and use Tally-specific structured resources or metadata required by the platform. 

Syntax 

[Resource: TSPL Resource_Name] 

Resource Type     : BMP / CSS / Cursor / ExcelXML / Gif / HTML / Icon / JAVASCRIPT / JPEG / JSON / JSONSchema / MSEXCEL / ODS / ODT / Png / TSF / TTFFONT / WORDXML / XML 

Example 

[Resource: TSPL Smp Resource from Application] 

Resource      : “Form VAT 100.xml” 

Resource Type : Word XML 

Explanation

In this example, the Resource Type attribute is set to Word XMLindicating that the referenced resource Form VAT 100.xml should be interpreted as a Microsoft Word XML document template. Based on this type, Tally loads and processes the resource as a document template rather than as an image, icon, or any other supported resource. The Resource Type attribute therefore determines how the referenced resource is handled at runtime and ensures that the appropriate processing logic is applied. If the same resource were intended to represent an image, icon, or Excel template, the corresponding resource type such as BMP, ICON, or MSEXCEL would need to be specified instead. This demonstrates the importance of Resource Type in enabling Tally to correctly interpret and use the referenced resource. 

External resources such as document templates, images, fonts, and other files are often stored separately from the TDL application. Source is an attribute used to specify the physical path or location of the file from which the resource should be loaded. It enables Tally to locate and access the required file during execution, ensuring that the correct content is available whenever the associated Resource definition is referenced. The source can point to a file on the local file system or another supported location, depending on the type of resource being used.  

Unlike the Resource attribute, which identifies a resource by its name or identifier when it is embedded within an application, DLL, or EXE, the Source attribute specifies the physical location of a standalone file. In simple terms, use Source when the required asset exists as a separate file, and use Resource when the asset is already packaged inside another application or library. 

Syntax 

[Resource: TSPL Resource_Name] 

Source                    : <File Path> 

Example 

[Resource: InvoiceWord] 

Source         : “D:\Work\InvoiceWord.xml”  

Resource Type  : Word XML 

Explanation

In this example, the Source attribute specifies the physical location of the file InvoiceWord.xml, which is stored in the D:\Work directory. The Resource Type attribute indicates that the file is a Word XML document template. When this Resource definition is referenced from another TDL definition, such as a Form, Tally locates the template using the specified file path and loads it for document generation. This demonstrates how the Source attribute is used to reference standalone files stored on the file system, allowing templates and other resources to be maintained independently of the TDL code.

Is this information useful?
YesNo
TallyHelpwhatsAppbanner
Is this information useful?
YesNo
TARA