Download Free Tools for Tally ERP
FREE utilities for Tally Accounting Software

Friday, June 22, 2007

Example 26: Using $$FilterCount function

FilterCount is a Tally (Internal) function that allows you to count records of a Collection/table based on a filter condition.

Syntax:-
$$FilterCount: <CollectionName> : <Condition>

Return Value:
Numeric

Download TDL26 program.

This TDL program creates a Collection/table which contains some statistics data. However, this data is not displayed directly in Tally. To view the Collection data, you can use SQLRequest() function of RTSlink DLL. Refer, rtslink.blogspot.com for more information.
;; PRODUCT: TDL26
;; PRODUCT-ID: cd387cfa-1d7f-4g9a-52f8-ace40a2983be
;; AUTHOR: Shweta Computers
;;==========================================================================
;;This program defines a Collection called MyStatistics.
;;This collection can be accessed using SQLRequest() function of RTSlink DLL
;;==========================================================================

;;****** Collection definition ******
;;MyStatistics is a collection that contains a single Object (record) called MyObjects.
;;IsODBCTable is set as YES so that this collection is accessible to external programs

[Collection: MyStatistics]
Object: MyObjects
IsODBCTable: Yes

;;******* Object Definition *********
;;Herein we are defining an Object called "MyObjects" which comprises of THREE fields
;;1st: DebtorsLedgers - Number of Ledgers falling under group Sundry Debtors
;;2nd: CreditorsLedgers - Number of Ledgers falling under group Sundry Creditors
;;3rd: AllLedgers - Total Number of Ledgers

;;The FilterCount function requires a Formula (i.e. condition) as the 3rd parameter.
;;which is defined below
[Object: MyObjects]
DebtorsLedgers : $$FilterCount:Ledger:HasSundryDebtors
CreditorsLedgers: $$FilterCount:Ledger:HasSundryCreditors
AllLedgers : $$FilterCount:Ledger:AlwaysTrue

;;******* Global Formula definition ********
;;$Name refers to the Field NAME of Ledger Collection

[System: Formula]
HasSundryDebtors : $$IsLedOfGrp:$Name:$$GroupSundryDebtors
HasSundryCreditors: $$IsLedOfGrp:$Name:$$GroupSundryCreditors
AlwaysTrue : $$IsWindows

;;Notes
;;=====
;; $$IsLedOfGroup is a Tally Interenal Function that is used to check whether a Ledger falls under a
;; specific Group or not.
;; Syntax :- $$IsLedOfGroup: <LedgerName>: <GroupName>
;; Return Value:- Logical
;;
;; $$IsWindows is a Tally Internal Function which checks whether the OS is Windows or not.
;; Syntax :- $$IsWindows
;; Return Value:- Logical
;;
;; $$GroupSundryDebtors is a Tally Internal Function
;; Syntax :- $$GroupSundryDebtors
;; Return Value:- String: The Group-Name for pre-defined Tally Group "Sundry Debtors"
;;
;; $$GroupSundryCreditors is a Tally Internal Function
;; Syntax :- $$GroupSundryCreditors
;; Return Value:- String: The Group-Name for pre-defined Tally Group "Sundry Creditors"
Tally; Tally Developer and Tally Definition Language are trademarks or registered trademarks of "Tally Solutions", Bangalore.