No. 1 Trusted Tally on Cloud service provider with pocket-friendly price & no hidden cost.

Connect with our Experts for quality service & discount prices.
tdl prefixes and symbols

Prefixes and Symbols used in TDL

TDL – Prefixes and Symbols

There are a few symbols as TDL components  that are used for specific tasks. Prefixes/ some symbols act as access specifiers, which means they are primarily used to get the value of a method, variable, field, formula, and so on. Modifiers, for example, are applied in normal situations.

Access Specifiers/Symbol Prefixes

Mentioned below are Access Specifiers/Symbol Prefixes

Symbols

Download Free 90+ Tally Shortcut Keys

    Usage

    @

    For accessing local formula.

    @@

    To get the value of a System formula, use this function.

    #

    When prefixed to Field name provides the field value.

    ##

    To obtain the global variable value, use this function.

    $

    To obtain the Object Method value, use this function.

    $$

    For calling a function.

    General Symbols

    Symbols

    Usage

    ; ;; ;;; /* */

    For adding TDL comments.

    +

    It's used as a character for line continuation.

    _ (underscore)

    Methods are exposed to ODBC SQL Procedures.

    *

    To Reinitialize a Definition, use this approach.

    !

    To make an Optional Definition, use this symbol.

    #

    Used as a modifier for definition.

    The Usage of @ and @@

    Formula

     

    Large complex calculations in TDL can be deconstructed into smaller basic equations or expressions written as a Formula. The symbol prefixes @ and @@ can be used to retrieve the values computed using these formulas.

    symbol prefixes

    Formula Naming Conventions

     

    • Insensitive case
    • The use of only alphanumeric characters is permitted.
    • At Definition time, space is insensitive. However, spaces are not permitted during deployment or use of the same.

    Formula classifications

     

    • Formula for local
    • Formula for Globe

    Use @ to define a local formula

    Any Interface Definition can define and get a Local Formula. The local formula’s scope is within the present definition. When a formula is definition-specific and not needed by any other definition, it is generally local formula.

     

    The Symbol Prefix @ can be used to get the Local Formula value.

    Example

    [Field: CompanyNameandAddress]

    Set as : “XYZ Company, Andheri, Mumbai”

    Using the Local Formula this code can also be written, as:

    [Field : CompanyNameandAddress]
    Company : “XYZ company, ”
    Address : “Andheri, ”
    City : “Mumbai”
    Set as : @Company + @Address + @City

    Use @@ to define a Global Formula

    A global formula is one that is available anywhere in the world after being defined once. In other words, all Definitions have access to the Global Formula value. When a formula is needed in multiple places, it is defined as a global formula. The Symbol Prefix @@ can be used to get the Global Formula value. A System Formula is another term for a Global Formula.

    Example

    [System : Formula]
    AmtWidth : 20
    [Field : RepTitleAmt]
    Width : @@AmtWidth
    [Field : RepDetailAmt]
    Width : @@AmtWidth
    [Field : RepTotalAmt]
    Width : @@AmtWidth

    All of the Fields in this example have identical widths. If the field width needs to be changed, only the [System: Formula] Definition Section needs to be changed. Using the Global Formula AmtWidth, this adjustment will be implemented to all Fields.

    # and ## Usage

    # (Symbol Prefix) can be used in TDL for:

     

    • Using # to refer a field
    • Using # to modify the existing definitions

    Using # to refer a field

    To extract the value from another Field, use # Symbol Prefix.

    [Field : HW]
    Set as : “Hello World”
    [Field : HW1]
    Set as : #HW

    The Field value ‘HW’ is placed to the Field ‘HW1′ in this example. In other terms, #HW is used to set the Field HW1 to “Hello World.”

    Use # for Modifying existing Definitions

    Existing definitions can also be modified using # Symbol Prefix. The definition’s attributes can be altered. For instance, insert a new Field in the ‘Line‘ definition.

    Example

    [#Menu : Gateway of Tally]
    Add : Key Item : Hello World: H : Display : HWReport
    Title : “Tally Gateway”
    [#Field : LedParticulars]
    Width : 50

    In this example, the existing ‘Gateway of Tally’ (default Menu) has been modified to include the ‘Hello World’ Item and the Menu Title has been modified to “Tally Gateway“.

    Accessing value from a Variable using ##

    A Variable is a named data container that can be changed as needed. Variables in TDL are divided into two categories: local and global variables. Within a single Report, local variables preserve their value. On contrary, Global variables depending on the ‘Variable’ Definition, preserve their values during the session or permanently.

     

    The symbol prefix ## can be used to access the Variable value. ## can be used to retrieve both local and global variables. The local variable is evaluated first. If the Local Variable is not identified, the value of the Global Variable is assumed.

    Example

    [Field : FGField]
    Set as : ##RTitle
    [Report : DBLedReport]
    Title : if ##LedgerName = “ ” then “Daybook” else “Ledger Report”

    prefix tdl specific

    $ and $$ Usage

    Use $ For Accessing a Method

    A Method or UDF can be used to extract any data from an Object. The $ Prefix is utilized to deploy any Object value from Method or UDF, where the ‘Method’ and ‘Object’ terms are TDL-specific. In the parts below, we’ll go through this in further detail.

    Context Fall Through for $

     

    • Verify if it’s an Internal method or a UDF within the current object.
    • User-Defined Method
    • The formula for the System
    • Repeat the above steps after changing the context as the parent object.

    Example

    [Field: My Field]
    Set as : $Name

    The value of the linked object’s method “Name” is displayed in this code snippet.

    Use $$ For Calling an Internal Function

    Functions are in-built in TDL and can be used by TDL programmers. A function can take zero or even more arguments and perform a task on them before returning a value. Spaces and special characters with the exception of bracket () are not permitted when giving arguments to functions, to return the expression result as a function parameter.

    Example

    [Field : Current Date]
    Set as : $$MachineDate
    [Field : Credit Amt]
    Set as : if $$IsDr:$ClosingBalance then 0 else $ClosingBalance
    [Field : StringPart Field]
    Set as : $$StringPart($Email:Company:##SVCurrentCompany):0:5

    Use ;, ;; and /**/ for commenting a Code

    Commenting improves the readability. Symbol prefixes like-;, ;; and /* */ can be used to give comments in TDL. Part line commenting is done with Symbol Prefix;, single line commenting is done with ;; and multi-line commenting is done with /* */. The TDL Interpreter will treat all lines enclosed in /* and */ as comments and ignore them.

     

    For single-line comments, a single semi-colon (;) is appropriate as a comment, although it is advised to use a Double Semi-Colon (;;) as per a standard coding approach.

    Example

    /*
    This code explains the usage of Multi-Line Commenting
    as well as Single Line Commenting.
    */
    ;; Altering Menu ‘Gateway of Tally’
    [#Menu : Gateway of Tally]
    Add : Key Item : Comment : C : Display: Comment
    ;; Menu Item alteration ends here

    Line Continuation Character (+)

    The Line Continuation Character (+) is used to break up a long line into several smaller lines. The programmer can now see the complete line without having to scroll to the left or right. This can also make it easier to comprehend and debug the code.

    Example

    /*
    This code explains the mechanism of breaking a line into Multiple Lines using + */
    ;; Altering Menu ‘Gateway of Tally’
    [#Menu: Gateway of Tally]
    Add : Key Item : Before : @@locQuit : LineCtn : C : Display : +
    LineCtn : NOT $$IsEmpty:$$SelectedCmps

    Exposing Methods and Creating Procedures (_)

    Methods are exposed to ODBC using the Symbol Prefix (_). When a Collection Name is prefixed with _, it becomes a procedure that may be referenced externally by giving the parameter as a Variable.

    Example

    ;; Exposing Methods within the Objects to ODBC
    [#Object : Ledger]
    _Difference : $ClosingBalance – $OpeningBalance
    ;; Creating Procedures to be referenced externally
    [Collection : _LedBills]
    Type : Bills
    Child of : #UName
    SQLParms : UName
    SQLValues: Bill No : $Name
    SQLValues: Bill Date : $$String:$BillDate:UniversalDate

    operators for replacing code

    Reinitialize Definitions (*)

    Operators like ‘#’ (Modify) and ‘!’ (Option) are similar to this.  It overrides all of the Definition’s attributes when a ‘*’ is applied for an existing definition. This is especially handy when the present definition content needs to be totally replaced with new code.

    Example

    [*Field : MyField]
    Width : 20% Page
    Set as : “This Field has been reinitialized”

    Optional Definitions (!)

    Optional definitions are defined using the Symbol Prefix !. Attributes   ‘Switch’ and ‘Option’ are used to deliver a conditional outcome in TDL via various definitions such as Menu, Form, Part, Line, Field, Collection, Button, Key, Import File, and Import Object. They cannot, however, be combined with Report, Color, Style, Variable, System Formula, System Variable, System UDF, Border, or Object definitions.

     

    Only if the Logical Condition is fulfilled, the original definition attributes are overruled by the optional definition attributes. To put it another way, if the Logical Condition returns TRUE, the optional definition’s attributes become part of the original definition; otherwise, they are dismissed, leaving the original definition unchanged.

     

    Syntax

     

    Option : <Optional Definition> : <Logical Condition>

     

    Switch : Label : <Optional Definition> : <Logical Condition>

     

    Switch and Option differ in a way that ‘Switch‘ statements bear the same label are run until a satisfying condition is obtained. On the other hand, ‘Option‘ runs all of the Option statements that match the provided conditions in order. Switch statements bearing distinct labels are identical to Option statements, in that all Switch statements will all be performed as the conditions provided.

    Example – Option

    [Line : MFTBDetails]
    Fields : MFTBName
    Right Fields : MFTBDrAmt, MFTBCrAmt
    Option : MFTBDtlsClsgG1000 : $ClosingBalance > 1000
    Option : MFTBDtlsClsgL1000 : $ClosingBalance < 1000
    [!Line : MFTBDtlsClsgG1000]
    Local : Field : MFTBDrAmt : Style : Normal Bold
    Local : Field : MFTBCrAmt : Style : Normal Bold
    [!Line : MFTBDtlsClsgL1000]
    Local : Field : MFTBDrAmt : Style : Normal
    Local : Field : MFTBCrAmt : Style : Normal

    The condition indicated in both options will be verified in this code snippet and the options meeting the specified condition will be performed. In this circumstance, it’s possible that more than one criteria are met and the action is carried out.

    Example – Switch

    [Line : MFTBDetails] Fields : MFTBName
    Right Fields : MFTBDrAmt, MFTBCrAmt
    Switch : Case 1 : MFTBDtlsClsgG1000 : $ClosingBalance > 1000
    Switch : Case 1 : MFTBDtlsClsgL1000 : $ClosingBalance < 1000
    [!Line : MFTBDtlsClsgG1000]
    Local : Field : MFTBDrAmt : Style : Normal Bold
    Local : Field : MFTBCrAmt : Style : Normal Bold
    [!Line : MFTBDtlsClsgL1000]
    Local : Field : MFTBDrAmt : Style : Normal
    Local : Field : MFTBCrAmt : Style : Normal

    The conditions mentioned in the switch statements will be verified one by one in this code snippet. In contrast to ‘Option,’ just the first statement fulfilling the specified condition is performed, and all other statements gathered under the label ‘Case 1′ are not implemented further. If desired, a behavior similar to that of ‘Option’ can be implemented by defining different labels.

    Conclusion:

    The different special symbols used in TDL include Access Specifiers and General symbols. The @ and @@ Access Specifiers are used to access the local and global formulas values, respectively. # can be used to refer to a field or to make changes to an existing definition. The ## symbol is used to access the Local or Global variable values. Accessing a method or UDF $$ is used and for calling a function $$ is used. For any Tally on Cloud service-related details visit Tallystack.in.

    To learn more about Tally On Cloud, you can check out our videos.

    Purnima
    No Comments

    Post a Comment

    Comment
    Name
    Email
    Website

    Call Now Button