Home > other >  Not able to fetch LedgerList data in xml request from tally
Not able to fetch LedgerList data in xml request from tally

Time:08-20

while exporting data from tally, I'm not able to fetch ledger details of the invoice.

Only able to fetch the outer level details.

I tried with Walk by: Ledger Entries but it not comes under Voucher tag.. how to made it possible.

Also having big doubt in Form, Part, Line work flow.

<ENVELOPE>
<HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Data</TYPE>
    <ID>DaybookGR</ID>
</HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>   
                <EXPLODEFLAG>Yes</EXPLODEFLAG>
                <CURRENTCOMPANY>${company}</CURRENTCOMPANY> 
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
                <SVFROMDATE>${fromDate}</SVFROMDATE>
                <SVTODATE>${toDate}</SVTODATE> 
            </STATICVARIABLES>
            <TDL>
                <TDLMESSAGE>
                    <REPORT NAME="DaybookGR">
                        <FORMS>DaybookGR</FORMS>
                        <TITLE>DaybookGR </TITLE>
                    </REPORT>
                    <FORM NAME="DaybookGR">
                        <TOPPARTS>DaybookGR</TOPPARTS>
                        <XMLTAG>"TallyGraphs"</XMLTAG>
                    </FORM>
                    <PART NAME="DaybookGR">
                        <TOPLINES>Daybook Line Title, Daybook Details</TOPLINES>
                        <REPEAT>Daybook Details : GetLedgerCollAmt</REPEAT>
                        <SCROLLED>Vertical</SCROLLED>
                        <COMMONBORDERS>Yes</COMMONBORDERS>
                    </PART>
                    <PART NAME="Ledgerlist Line Title">
                     <TOPLINES>Ledgerlist Line Title,Ledger Details</TOPLINES>
                        <REPEAT>Ledger Details : GetLedger</REPEAT>
                        <SCROLLED>Vertical</SCROLLED>
                        <COMMONBORDERS>Yes</COMMONBORDERS>
                    </PART>
                    <LINE NAME="Daybook Line Title">
                        <USE>Daybook Details</USE>
                        <LOCAL>Field : Default : Type : String </LOCAL>                
                        <LOCAL>Field : Field Amount : Set as: "Amount"</LOCAL>  
                    </LINE>
                    <LINE NAME="Ledgerlist Line Title">
                        <USE>Ledger Details</USE>
                        <LOCAL>Field : Default : Type : String </LOCAL>                
                        <LOCAL>Field : Field Amount : Set as: "Amount"</LOCAL>  
                    </LINE>
                    <LINE NAME="Daybook Details">   
                        <LEFTFIELDS>PartyLedgerName</LEFTFIELDS>
                        <RIGHTFIELDS>vchType,VoucherNumber,Amount,Date</RIGHTFIELDS>
                        <XMLTAG>Voucher</XMLTAG>
                        <EXPLODE>Ledgerlist Line Title</EXPLODE>
                        <BELONGSTO>YES</BELONGSTO>
                    </LINE>
                    <LINE NAME="Ledger Details">    
                        <LEFTFIELDS>PartyLedgerName</LEFTFIELDS>                        
                        <XMLTAG>LedgerList</XMLTAG>
                    </LINE>
                    <FIELD NAME="PartyLedgerName">
                        <USE>Name Field</USE>
                        <SET>$LedgerName</SET>
                    </FIELD>  
                   <FIELD NAME="Date">
                        <USE>Long Date Field</USE>                  
                        <SET>$$DDMMYYYYDateFormat:$Date:"-"</SET>                     
                    </FIELD>
                    <FIELD NAME="VoucherNumber">
                        <USE>Name Field</USE>
                        <SET>$VoucherNumber</SET>
                    </FIELD>
                    <FIELD NAME="Amount">
                        <USE>Amount Field</USE>
                        <SET>$Amount</SET>
                    </FIELD>
                
                    <COLLECTION NAME="AllVouchers" ISMODIFY="No">
                        <TYPE>Voucher</TYPE>
                        <BELONGSTO>YES</BELONGSTO>
                    </COLLECTION>
                    <COLLECTION NAME="GetLedger" ISMODIFY="No">
                    <walk>Ledger</walk>
                        <BELONGSTO>YES</BELONGSTO>                     
                            <FILTER>IsOptionalFilter</FILTER>
                              <FETCH>PartyLedgerName</FETCH>         
                        </COLLECTION>
                    <COLLECTION NAME="GetLedgerCollAmt" ISMODIFY="No">
                            <SourceCOLLECTION>AllVouchers</SourceCOLLECTION>                                                    
                            <FILTER>IsOptionalFilter</FILTER>                   
                              <FETCH>VoucherNumber,LedgerName,Amount,VoucherTypeName,Date</FETCH>                             
                        </COLLECTION> 
                        <SYSTEM TYPE="Formulae" NAME="IsOptionalFilter">NOT $IsOptional</SYSTEM> 
                </TDLMESSAGE>
            </TDL>
        </DESC>
    </BODY>
</ENVELOPE>

My expecting output structure is

`<TALLYGRAPHS>
        <VOUCHER>
              <PARTYLEDGERNAME></PARTYLEDGERNAME>
              <VOUCHERTYPENAME></VOUCHERTYPENAME>
              <VOUCHERNUMBER></VOUCHERNUMBER>
              <AMOUNT></AMOUNT>
              <DATE></DATE>
            <Ledgerlist>........</Ledgerlist>
            <Ledgerlist>........</Ledgerlist>
         </VOUCHER>
         <VOUCHER>
                 <PARTYLEDGERNAME></PARTYLEDGERNAME>
                  <VOUCHERTYPENAME></VOUCHERTYPENAME>
                  <VOUCHERNUMBER></VOUCHERNUMBER>
                   <AMOUNT></AMOUNT>
                    <DATE></DATE>
            <Ledgerlist>........</Ledgerlist>
            <Ledgerlist>........</Ledgerlist>
         </VOUCHER>
    </TALLYGRAPHS>`

CodePudding user response:

If you want use you have implement everything else extend current one

If you want control of fields you want in Ledger Entries, then you want take everything into control

<ENVELOPE>
    <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>DaybookGR</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <EXPLODEFLAG>Yes</EXPLODEFLAG>
                <CURRENTCOMPANY>${company}</CURRENTCOMPANY>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
                <SVFROMDATE>${fromDate}</SVFROMDATE>
                <SVTODATE>${toDate}</SVTODATE>
            </STATICVARIABLES>
            <TDL>
                <TDLMESSAGE>
                    <REPORT NAME="DaybookGR">
                        <FORMS>DaybookGR</FORMS>
                        <TITLE>DaybookGR </TITLE>
                    </REPORT>
                    <FORM NAME="DaybookGR">
                        <TOPPARTS>DaybookGR</TOPPARTS>
                        <XMLTAG>"TallyGraphs"</XMLTAG>
                    </FORM>
                    <PART NAME="DaybookGR">
                        <TOPLINES>Daybook Line Title, Daybook Details</TOPLINES>
                        <REPEAT>Daybook Details : GetLedgerCollAmt</REPEAT>
                        <SCROLLED>Vertical</SCROLLED>
                        <COMMONBORDERS>Yes</COMMONBORDERS>
                    </PART>
                    <PART NAME="Ledgerlist Line Title">
                        <TOPLINES>Ledger Details</TOPLINES>
                        <REPEAT>Ledger Details:LedgerEntries</REPEAT>
                        <SCROLLED>Vertical</SCROLLED>
                        <COMMONBORDERS>Yes</COMMONBORDERS>
                    </PART>
                    <LINE NAME="Daybook Line Title">
                        <USE>Daybook Details</USE>
                        <LOCAL>Field : Default : Type : String </LOCAL>
                        <LOCAL>Field : Field Amount : Set as: "Amount"</LOCAL>
                    </LINE>
                    <LINE NAME="Ledgerlist Line Title">
                        <USE>Ledger Details</USE>
                        <LOCAL>Field : Default : Type : String </LOCAL>
                        <LOCAL>Field : Field Amount : Set as: "Amount"</LOCAL>
                    </LINE>
                    <LINE NAME="Daybook Details">
                        <LEFTFIELDS>PartyLedgerName</LEFTFIELDS>
                        <RIGHTFIELDS>vchType,VoucherNumber,Amount,Date</RIGHTFIELDS>
                        <XMLTAG>Voucher</XMLTAG>
                        <EXPLODE>Ledgerlist Line Title</EXPLODE>
                    </LINE>
                    <LINE NAME="Ledger Details">
                        <LEFTFIELDS>PartyLedgerName</LEFTFIELDS>
                        <XMLTAG>LedgerList</XMLTAG>
                    </LINE>
                    <FIELD NAME="PartyLedgerName">
                        <USE>Name Field</USE>
                        <SET>$LedgerName</SET>
                    </FIELD>
                    <FIELD NAME="Date">
                        <USE>Long Date Field</USE>
                        <SET>$$DDMMYYYYDateFormat:$Date:"-"</SET>
                    </FIELD>
                    <FIELD NAME="VoucherNumber">
                        <USE>Name Field</USE>
                        <SET>$VoucherNumber</SET>
                    </FIELD>
                    <FIELD NAME="Amount">
                        <USE>Amount Field</USE>
                        <SET>$Amount</SET>
                    </FIELD>
                    <COLLECTION NAME="AllVouchers" ISMODIFY="No">
                        <TYPE>Voucher</TYPE>
                        <BELONGSTO>YES</BELONGSTO>
                    </COLLECTION>
                    
                    <COLLECTION NAME="GetLedgerCollAmt" ISMODIFY="No">
                        <SourceCOLLECTION>AllVouchers</SourceCOLLECTION>
                        <FILTER>IsOptionalFilter</FILTER>
                        <FETCH>VoucherNumber,LedgerName,Amount,VoucherTypeName,Date,Ledgerentries.*</FETCH>
                    </COLLECTION>
                    <SYSTEM TYPE="Formulae" NAME="IsOptionalFilter">NOT $IsOptional</SYSTEM>
                </TDLMESSAGE>
            </TDL>
        </DESC>
    </BODY>
</ENVELOPE>

If you don't want control of fields in Ledger Entries then use below XML

<ENVELOPE>
    <HEADER>
        <VERSION> 1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>COLLECTION</TYPE>
        <ID>AllVouchers</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <EXPLODEFLAG>Yes</EXPLODEFLAG>
                <CURRENTCOMPANY>${company}</CURRENTCOMPANY>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
                <SVFROMDATE>${fromDate}</SVFROMDATE>
                <SVTODATE>${toDate}</SVTODATE>
            </STATICVARIABLES>
            <TDL>
                <TDLMESSAGE>
                   
                    <COLLECTION NAME="AllVouchers" ISMODIFY="No">
                        <TYPE>Voucher</TYPE>
                        <FETCH>LedgerEntries.*</FETCH>
                        <BELONGSTO>YES</BELONGSTO>
                    </COLLECTION>
                    
                </TDLMESSAGE>
            </TDL>
        </DESC>
    </BODY>
</ENVELOPE>
  • Related