https://help.tallysolutions.com/docs/td9rel54/tdl_reference/release_3_6.htm

What’s New in Release 3.6

Collection Enhancements

New methods LastModifiedDate and LastModifiedTime for File Properties

In Collection definition, Directory as a Data Source was supported in Release 3.0, where the properties of the file, i.e., Name, FileSize, IsDirectory, IsReadOnly and IsHidden, were supported as the Methods. In Release 3.6, two new methods called LastModifiedDate and LastModifiedTime have been introduced, to extract additional file properties in Tally.

This can be very useful in Integration scenarios with Tally using external Files. The last imported date and time can be validated against the Last Modified Date and Time of the File prior to importing from the file.

Method - $LastModifiedDate

$LastModifiedDate – It returns the date on which the file was last altered. The format supported is dd-mm-yyyy.

Syntax

$LastModifiedDate

Example

[Collection: ListofFiles]

Data Source : Directory : "C:\"

Format      : $Name, 25

Format      : $FileSize, 15

Format      : $IsReadOnly, 15

Format      : $LastModifiedDate, 15

Here, $ LastModifiedDate will return the date on which the file was last modified, for example, 27-May-2012.

Method - $LastModifiedTime

$LastModifiedTime – It returns the time at which the file was last altered. The format supported is hh:mm:ss (24 hours)

Syntax

$LastModifiedTime

Example

[Collection : ListofFiles]

Data Source : Directory : "C:\"

Format : $Name, 25

Format : $FileSize, 15

Format : $IsReadOnly, 15

Format : $LastModifiedDate, 15

Format : $LastModifiedTime, 15

Here, $LastModifiedTime will return the time at which the file was last modified, e.g., 16:28:18. Following screen capture displays the last modified date and the last modified time in the table:

Figure_1._File_properties_containing_Last_Modified_Date_and_Last_Modified_Time_(3.6).jpg

Action Enhancements

Action - Execute TDL

TDL action Execute TDL has been introduced to programmatically load TDL, perform some actions and subsequently, unload the TDL or keep the TDL loaded for the current Tally session.

This can prove to be very useful in cases where the user needs to programmatically associate a TDL on the fly, for performing some operations.

Syntax

EXECUTE TDL : <TDL/TCP File Path>[: <Keep TDL Loaded Flag> : <Action>: <Action Parameters>]

Where,

< TDL/TCP File Path > specifies the path of the TDL/TCP File to be loaded dynamically.

< Keep TDL Loaded Flag > is the Logical Flag to determine if the TDL should be kept loaded after the action is executed. If the value is set to YES, then the TDL will continue to be loaded, else the Executed TDL will be unloaded after the execution of the specified action.

< Action > specifies the global Action to be performed, i.e., Display, Alter, Call, etc.

< Action Parameters > are the parameters on which the Action is performed. For example:

If the action is Call, the Action Parameters contain the Function name along with the Function parameters, if any.

If the action is Display, Alter, etc., then the Parameter should be the Report Name.

Example: 1

[Function : TDL Execution with Keep TDL Loaded enabled]

00 : Execute TDL : "C:\Tally.ERP9\BSTitleChange.TDL" :Yes : Display : Balance Sheet

10 : Display : Balance Sheet

The file BSTitleChange.TDL contains the following lines of code:

[#Report: Balance Sheet]

Title : "TDL Executed Programmatically"

In this example, the TDL BSTitleChange.TDL , which is used to change the Title of the report Balance Sheet, is loaded dynamically by executing the action Execute TDL. The Keep TDL Loaded Flag is set to YES in the above code snippet. Based on the subsequent action Display: Balance Sheet, the Balance Sheet report will be shown with a new Title. The next statement also displays the Balance sheet. The title for this will again be the same, i.e., the changed title, as the dynamic TDL is still loaded, even after the action Execute TDL has completed its execution.

Example: 2

[Function : TDL Execution with Keep TDL Loaded enabled]

00 : Execute TDL : "C:\Tally.ERP9\BSTitleChange.TDL" : No : Display : Balance Sheet

10 : Display : Balance Sheet

Here, the report Balance Sheet would be displayed twice and the title of the first report is “TDL Executed Programmatically”, i.e., the changed title as per BSTitleChange.TDL ; whereas, in the second report, the title is Balance sheet, since the attribute Keep TDL Loaded Flag is set to NO.

Platform Functions and Variables

Function - $$PrinterInfo

Function $$PrinterInfo has been introduced to extract the settings information for any installed printer. This function is very useful to get the information of the printer, based on which, we can determine the dimensions for pre-printed invoice, etc.

Syntax

$$PrinterInfo : <Printer Name> : <Information Type>

Where,

< Printer Name > refers to the name of the printer for which the information is required.

< Information Types > are permissible information types like PrintSizeinInches, LeftMarginInMMs, etc.

Example

$$PrinterInfo : HPLaserJet4250PCL6 : PrintSizeInInches

The list of permissible Information Types are:

LeftMarginInMMs returns the Number which denotes the space to be left on the Left side of the page in Millimeters.

TopMarginInMMs returns the Number which denotes the space to be left on the Top of the page in Millimeters.

RightMarginInMMs returns the Number which denotes the space to be left on the Right side of the page in Millimeters.

PrinterExists returns Logical value (YES/NO), indicating if the Printer Exists or not.

PrintSizeInInches returns the dimensions which denotes the Print Area in Inches, i.e., excluding the Margins.

PrintSizeInMMs returns the dimensions which denotes the Print Area in Millimeters, i.e., excluding the Margins.

PrintSizeInLines returns the dimensions which denotes the Print Area in Lines, i.e., excluding the Margins.

PaperSizeInInches returns the dimensions which denotes the Paper Size in Inches, which includes the Margins.

PaperSizeInMMs returns the dimensions which denotes the Paper Size in Millimeters, which includes the Margins.

PaperSizeInLines returns the dimensions which denotes the Paper Size in Lines, which includes the Margins.

PaperType returns the selected Type of the Paper, e.g., A4, A5 Small, etc.

PortName returns the Port Name configured for the Printer.

Orientation returns the Orientation Type of Paper, i.e., Landscape or Portrait.

The following screen capture displays the selected Printer details for all the information types:

Figure_2._Printer_Details_(3.6).jpg

Function - $$IsInternetActive

$$IsInternetActive is a function which helps to determine if the Internet is currently active. It returns TRUE if the Internet is accessible, else returns FALSE. It can be used to perform conditional operations, i.e., based on the Internet Connectivity, certain actions can be triggered.

This function checks if the internet is active, such that the operations pertaining to connecting to web pages, emailing, uploading files to FTP, etc., can be performed.

Syntax

$$IsInternetActive

Example

[Function : EmailifConnected]

00 : IF : $$IsInternetActive

;; Function called to Email O/s Stmts

10 : Call : Email Outstanding Statements

20 : ENDIF

In this example, the Outstanding Statements are E-Mailed, if Internet connection is present.

Function - $$CaseConvert

Prior to this release, the function $$Upper has been used to convert the string expressions to upper case, but there were no functions available for other conversions like Lower case, Title Case, etc. To overcome the difficulty of converting the string to Lower case, Title case, etc., a new function $$CaseConvert has been introduced, to convert the case of the given expression to the specified case format. This function will return a string expression in the converted format.

This function is very useful when one needs to follow the case rules to display the Name of the company, Name of the bank, etc.

Syntax

$$CaseConvert : <CaseKeyword> : <Expression>

Where,

< CaseKeyword > can be All Capital, Upper Case, All Lower, Lower Case, Small Case, First Upper Case, Title Case, TitleCaseExact, Normal, Proper Case, etc.

All Capital/Upper Case converts the input expression to upper case.

All Lower/Lower Case/Small Case converts the input expression to lower case.

First Upper Case converts the first letter of the first word in a sentence to upper case. Other characters will remain as they are.

Title Case converts the input expression to Title case, i.e., the principal words should start with capital letters.

It will not convert the prepositions, articles or conjunctions, unless one is the first word.

It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. For this subset of words, the original strings’ cases will be preserved.

TitleCaseExact converts the input expression to Title case, i.e., the principal words will start with capital letters.

It will not convert the prepositions, articles or conjunctions, unless one is the first word.

It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. This subset of words will be converted to small case.

Proper Case converts the input expression to Title case, i.e., all the words in a sentence should start with capital letters.

Normal preserves the input expression as it is.

< Expression > is any expression of type ‘String’.

Example: 1

To convert the expression to upper case:

[Field : String Convert]

Set as : $$CaseConvert:UpperCase:“Tally solutions Pvt. Ltd.”

In this example, the function returns “TALLY SOLUTIONS PVT. LTD.” in the field ‘String Convert’.

Example: 2

To convert the expression to Lower case:

[Field c: String Convert]

Set as : $$CaseConvert : LowerCase : “Tally Solutions Pvt. Ltd.”

Here, the function returns, “tally solutions pvt. ltd.” in the field ‘String Convert’.

Example: 3

To convert the expression to Title Case:

[Field: String Convert]

Set as : $$CaseConvert:TitleCase:“To convert the striNg to Title case”

Here, the function returns “To Convert the StriNg to Title Case” in the field ‘String Convert’.

Example: 4

To convert the expression to Title Case Exact:

[Field : String Convert]

Set as : $$CaseConvert:TitleCaseExact:“To convert the string to Title case”

Here, t h e function returns “ T o Conv e rt the Stri n g to Title Case” in the field ‘String Convert’.

Example: 5

To convert the expression to f irst u p per case:

[Field : String Convert]

Set as : $$CaseConvert:FirstUpperCase:“Tally solutions pvt. ltd.”

Here, the function returns “Tally solutions pvt. ltd.” in the field ‘String Convert’.

Function - $$RandomNumber

A random number is a number generated by a process whose outcome is unpredictable, and which cannot be subsequently reliably reproduced. In other words, Random numbers are numbers that occur in a sequence such that, the values are uniformly distributed over a defined interval and it is impossible to predict future values based on past or present ones.

In this release, a new TDL function $$RandomNumber has been introduced to generate Random Numbers. In case of auditing, this can be useful for auditors who would like to pick up some vouchers randomly for authentication.

Syntax

$$RandomNumber[:<MinRange>[:<MaxRange>]]

Where,

< Min Range > and < Max Range > are optional. In the absence of Max Range, Long Max is considered, i.e., (2^31) - 1 = 2147483647. In the absence of Min Range, ZERO(0) is considered.

We can generate random numbers in different ways:

No Parameters: Don’t pass any parameters, i.e., just invoke $$ RandomNumber . Default values are assumed.

Only with the MinRange Parameter: Here, there is no need of passing Max range. In this scenario, Random number is generated from the given Min Range.

Both MaxRange and MinRange as Parameter: In this scenario, random numbers are generated for given range.

Example: 1

With no Parameters

Set As : $$RandomNumber

This code will return a Random Number between 0 and 2147483647.

Example: 2

With MinRange Parameter only

Set As : $$RandomNumber:9999

This code returns Random Numbers between 9999 and 2147483647, the random number being greater than or equal to 9999. Here, value of MinRange is 9999 and MaxRange is 2147483647.

Example: 3

With both Parameters (MinRange and MaxRange)

Set As : $$RandomNumber:9:9999

This code returns Random Numbers between 9 and 9999.

Variable - SVPrintOrientation

Variable SVPrintOrientation has been introduced to set the required Printer Orientation, that is, Portrait or Landscape, within a Report. It is recommended to declare a local variable within the function or report and set the variable value, to avoid the system Printer Configuration changes to be effected globally.

This is useful where a Report needs to printed in a different orientation, e.g., Landscape. For e.g., if one needs to print the cheques in ‘Landscape’ mode and other reports in ‘Portrait’ mode, then there is no need to keep switching the printer settings from Portrait to Landscape, and vice versa, based on the report getting printed. For Cheque Printing Report, one can default Landscape Orientation.

Example

[#Report : Balance Sheet]

;; Local Variable Declaration

Variable : SVPrintOrientation : String

Set      : SVPrintOrientation : “Landscape”

Since the variable is locally declared and updated within the Report Balance Sheet, the same will not affect the global printer settings.