I am using following xml request to get Vouchers from Tally and gives me below output.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>DaybookGR</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</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,PartyAmount,IsPartyLedger</LEFTFIELDS>
<RIGHTFIELDS>UserD</RIGHTFIELDS>
<XMLTAG>LedgerList</XMLTAG>
</LINE>
<FIELD NAME="PartyLedgerName">
<USE>Name Field</USE>
<SET>$LedgerName</SET>
</FIELD>
<FIELD NAME="PartyAmount">
<USE>Name Field</USE>
<SET>$Amount</SET>
</FIELD>
<FIELD NAME="IsPartyLedger">
<USE>Name Field</USE>
<SET>$ISPARTYLEDGER</SET>
</FIELD>
<LINE NAME="UserD Details">
<LEFTFIELDS>UserD</LEFTFIELDS>
<XMLTAG>UserList</XMLTAG>
</LINE>
<FIELD NAME="UserD">
<USE>Name Field</USE>
<SET>$USERDESCRIPTION</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>Ledgerentries.*</FETCH>
</COLLECTION>
<SYSTEM TYPE="Formulae" NAME="IsOptionalFilter">NOT $IsOptional</SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
Here is my output:
<TALLYGRAPHS>
<VOUCHER>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER></VOUCHERNUMBER>
<AMOUNT>-10000.00</AMOUNT>
<DATE></DATE>
<LEDGERLIST>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<PARTYAMOUNT>10,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
<LEDGERLIST>
<PARTYLEDGERNAME>Website Development</PARTYLEDGERNAME>
<PARTYAMOUNT>10,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
</VOUCHER>
<VOUCHER>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER></VOUCHERNUMBER>
<AMOUNT>-10000.00</AMOUNT>
<DATE></DATE>
<LEDGERLIST>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<PARTYAMOUNT>10,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
<LEDGERLIST>
<PARTYLEDGERNAME>Website Development</PARTYLEDGERNAME>
<PARTYAMOUNT>10,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<USERD>Testinbg Created</USERD>
</LEDGERLIST>
</VOUCHER>
<VOUCHER>
<PARTYLEDGERNAME>IBIRDS</PARTYLEDGERNAME>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER></VOUCHERNUMBER>
<AMOUNT>-5000.00</AMOUNT>
<DATE></DATE>
<LEDGERLIST>
<PARTYLEDGERNAME>IBIRDS</PARTYLEDGERNAME>
<PARTYAMOUNT>5,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
<LEDGERLIST>
<PARTYLEDGERNAME>Mobile App</PARTYLEDGERNAME>
<PARTYAMOUNT>5,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
</VOUCHER>
<VOUCHER>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER></VOUCHERNUMBER>
<AMOUNT>-46000.00</AMOUNT>
<DATE></DATE>
<LEDGERLIST>
<PARTYLEDGERNAME>Think Era</PARTYLEDGERNAME>
<PARTYAMOUNT>46,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<USERD></USERD>
</LEDGERLIST>
<LEDGERLIST>
<PARTYLEDGERNAME>Other Payables</PARTYLEDGERNAME>
<PARTYAMOUNT>6,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<USERD>This Is Great</USERD>
</LEDGERLIST>
<LEDGERLIST>
<PARTYLEDGERNAME>Website Development</PARTYLEDGERNAME>
<PARTYAMOUNT>40,000.00</PARTYAMOUNT>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<USERD>New E-Commerce</USERD>
</LEDGERLIST>
</VOUCHER>
</TALLYGRAPHS>
The only issue here is that I am not getting my all-User Descriptions associated with Ledger. For example, in above response, I have two User Description for Ledger (Other Payables) under Voucher number 4. but only getting first "This is Great". Here is the actual data in tally listed:
<VOUCHER>
...
<LEDGERLIST>
...
<UDF:USERDESCRIPTION.LIST DESC="`User Description`" ISLIST="YES" TYPE="String" INDEX="29">
<UDF:USERDESCRIPTION DESC="`User Description`">This is Great</UDF:USERDESCRIPTION>
<UDF:USERDESCRIPTION DESC="`User Description`">Project-Zuperscore</UDF:USERDESCRIPTION>
<UDF:USERDESCRIPTION DESC="`User Description`">Chandra Prakash- Working Days 19</UDF:USERDESCRIPTION>
<UDF:USERDESCRIPTION DESC="`User Description`">125000/22x19=107954.55</UDF:USERDESCRIPTION>
</UDF:USERDESCRIPTION.LIST>
...
</LEDGERLIST>
</VOUCHER>
How, I change my request to fetch all UDF:USERDESCRIPTION?
As I mentioned in How to limit nested fields in Tally XML Export Response , this type of xml is complicated and required TDL knowledge
USERDESCRIPTION you are referring to is part of collection not a simple field, so it requires its own part and line
Add below line in "Ledger Details" line and remove "UserD"
<EXPLODE>TC_LedgerEntryUserDescriptionsList:YES</EXPLODE>
Add Below part and line
<PART
NAME="TC_LedgerEntryUserDescriptionsList"
ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No">
<TOPLINES>
TC_LedgerEntryUserDescriptionsList</TOPLINES>
<REPEAT>TC_LedgerEntryUserDescriptionsList
: USERDESCRIPTION</REPEAT>
<SCROLLED>Vertical</SCROLLED>
<XMLTAG>USERDESCRIPTION.LIST</XMLTAG>
</PART>
<LINE
NAME="TC_LedgerEntryUserDescriptionsList"
ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No">
<FIELDS>UserD</FIELDS>
</LINE>