Search code examples
tally

How we can add TDL code into Tally XML request


I have one TCP file and I want to include that code in my Tally XML request to get data in response of the XML request. So that I don't have to be dependent that user has installed that TCP file or not..

Is this possible ? I have read that some where. But I am not able to get success in this. Any help is appreciated. Thanks in Advance.


Solution

  • If you can get the tdl version (the uncompiled source code), enclose it within the <TDL></TDL> tag. You could also use Tally Developer to convert the tdl source code into XML by right-clicking on the file and then clicking 'Convert to XML'.

    Here's a small request example that features a collection of ledgers that belong only to the Sundry Debtors Group.

    In TDL, it would be a simple 4-line code as follows:

    [Collection: SundryDebtorsLedgers]
        Type: Ledger
        Child Of: $$GroupSundryDebtors
        Fetch: Name, Parent, ClosingBalance
    

    In XML, the same request would be:

    <ENVELOPE>
        <HEADER>
            <VERSION>1</VERSION>
            <TALLYREQUEST>EXPORT</TALLYREQUEST>
            <TYPE>COLLECTION</TYPE>
            <ID>SundryDebtorsLedgers</ID>
        </HEADER>
        <BODY>
            <DESC>
                <TDL>
                    <TDLMESSAGE>
                        <COLLECTION NAME="SundryDebtorsLedgers">
                            <TYPE>Ledger</TYPE>
                            <CHILDOF>$$GroupSundryDebtors</CHILDOF>
                            <FETCH>Name, Parent, ClosingBalance</FETCH>
                        </COLLECTION>
                    </TDLMESSAGE>   
                </TDL>
            </DESC>
        </BODY>
    </ENVELOPE>