How to export a Stock Item Master using XML

Discussion in 'Requests' started by Akshay Adamuthe, Nov 6, 2021.

    
  1. Akshay Adamuthe

    Akshay Adamuthe New Member


    I want to export a list of stock items (including those having zero closing balance) through XML command. Please help.
     


  2. Sai Vineeth

    Sai Vineeth Member


    Use this XML to get all stock Items
     


  3. Himanshu-2002

    Himanshu-2002 Active Member


    Buddy, I think using default reports to get data from tally isn't the best way to integrate with Tally Because Probably parsing that will be unnecessary difficult
     
    Sai Vineeth likes this.


  4. Sai Vineeth

    Sai Vineeth Member


    That's custom report but gets all fields,
    If you want only some fields remove
    Code:
    <NATIVEMETHOD>*</NATIVEMETHOD>
    mention required fields in comma deiminated
    Code:
    <NATIVEMETHOD>CATEGORY,GUID</NATIVEMETHOD>
    This will only fetch required fields
     


  5. Himanshu-2002

    Himanshu-2002 Active Member


    I know that Bro, My concern was parsing the XML, It will be unnecessary difficult if we follow this way
     


  6. Sai Vineeth

    Sai Vineeth Member


    We are only fetching what we want and parsing only those fields, What is unnecessary here?
    What other way you suggest that will be easy?
     


  7. Himanshu-2002

    Himanshu-2002 Active Member


    Supposed You have two response:-

    1.
    <Name>Ledger 1</Name>
    <Parent>Sundry Debtors</Parent>

    2.
    <SVCurrentLanguage>Ledger 1</SVCurrentLanguage>
    <SVCurrentLanguage>Sundry Debtors</SVCurrentLanguage>

    Now, Please tell which is easier one to parse
     


  8. Sai Vineeth

    Sai Vineeth Member


    Obviously 1
    Have you tried the request xml provided by me?
    once try and comment
    In which way you get response ?
     


  9. Himanshu-2002

    Himanshu-2002 Active Member


    Nope, But I saw you were exporting default reports due to which I thought to show you a bit simpler way to integrate with tally... In which you can structure the XML as per your needs
     


  10. Himanshu-2002

    Himanshu-2002 Active Member


    Because If we use default reports then We have many limitations to fields, We can't add/Remove/Edit Xml tag names.
     


  11. Sai Vineeth

    Sai Vineeth Member


    First you try, then talk
     


  12. saravanan1999

    saravanan1999 New Member


    Hi Vineeth jii,

    How to XML Request gross profit and loss data in Profit & Loss Report
    Please Provide possible way,
    Thank You..!!
     


  13. Sai Vineeth

    Sai Vineeth Member


    Hi,
    At present I don't have any request xmls for reports(BS,P&L …etc.,) in Tally as I will not use those reports ,I will fetch all data from Tally and create reports dynamically with raw data
     
    saravanan1999 likes this.


  14. saravanan1999

    saravanan1999 New Member


    Thank You For Your Answer
     


  15. saravanan1999

    saravanan1999 New Member


    And, I Have an another query, i am trying to get the sales register inventry product items but i have only geting first product in each entry.
    I had tryed below code
    Please help me to get all product in sales register


    <ENVELOPE>
    <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Data</TYPE>
    <ID>All Vouchers</ID>
    </HEADER>
    <BODY>
    <DESC>
    <STATICVARIABLES>
    <EXPLODEFLAG>Yes</EXPLODEFLAG>
    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
    <SVFROMDATE>${fromDate}</SVFROMDATE>
    <SVTODATE>${toDate}</SVTODATE>
    <DBINVEXPLODEFLAG>Yes</DBINVEXPLODEFLAG>
    </STATICVARIABLES>
    <TDL>
    <TDLMESSAGE>
    <REPORT NAME="All Vouchers">
    <FORMS>SalesRegisterGR</FORMS>
    <TITLE>SalesRegisterGR </TITLE>
    </REPORT>
    <FORM NAME="SalesRegisterGR">
    <TOPPARTS>SalesRegisterGR, SYNCHeader, RTS SVSRMBody</TOPPARTS>
    <XMLTAG>"TallyGraphs"</XMLTAG>
    </FORM>
    <PART NAME="RTS SVSRMBody">
    <TOPPARTS>RTS SVSRMResponse</TOPPARTS>
    <XMLTAG>"BODY"</XMLTAG>
    <Vertical>Yes</Vertical>
    </PART>
    <PART NAME="RTS SVSRMResponse">
    <TOPPARTS>RTS SVSRMData</TOPPARTS>
    <XMLTAG>"IMPORTDATA"</XMLTAG>
    <Vertical>Yes</Vertical>
    </PART>
    <PART NAME="RTS SVSRMData">
    <TOPPARTS>RTS SVSRMTallyMsg</TOPPARTS>
    <XMLTAG>"REQUESTDATA"</XMLTAG>
    <Vertical>Yes</Vertical>
    </PART>
    <PART NAME="RTS SVSRMTallyMsg">
    <TOPLINES>RTS SVSRMMsgs Main</TOPLINES>
    <REPEAT>RTS SVSRMMsgs Main : RTS SVSendRemoteMsgs</REPEAT>
    <SCROLLED>Vertical</SCROLLED>
    </PART>
    <LINE NAME="RTS SVSRMMsgs Main">
    <XMLTAG>"TALLYMESSAGE"</XMLTAG>
    <XMLAttr>"xmlns:UDF" : "TallyUDF"</XMLAttr>
    <LINE>RTS SVSRMMsgs</LINE>
    </LINE>
    <LINE NAME="RTS SVSRMMsgs">
    <Field>Simple Field</Field>
    <FullObject>Yes</FullObject>
    </LINE>
    <PART NAME="SalesRegisterGR">
    <TOPLINES>SalesRegister Line Title, SalesRegister Details </TOPLINES>
    <REPEAT>SalesRegister Details : GetLedgerCollAmt</REPEAT>
    <SCROLLED>Vertical</SCROLLED>
    <COMMONBORDERS>Yes</COMMONBORDERS>
    </PART>
    <LINE NAME="SalesRegister Line Title">
    <USE>SalesRegister Details</USE>
    <LOCAL>Field : Default : Type : String </LOCAL>
    <LOCAL>Field : Field PartyLedgerName : Set as: "AmounrtyLedgerName : Set as: "Group Name"</LOCAL>
    <LOCAL>Field : Field Credit Amountt"</LOCAL>
    <LOCAL>Field : Field VoucherKey : Set as:$VoucherKey</LOCAL>
    <LOCAL>Field : Field VoucherNumber : Set as:$VoucherNumber</LOCAL>
    <LOCAL>Field : Field VoucherTypeName : Set as: "VoucherTypeName"</LOCAL>
    <LOCAL>Field : Field STKName : Set as:"STKNAME"</LOCAL>
    <LOCAL>Field : Field STName : Set as:"STNAME"</LOCAL>
    </LINE>
    <LINE NAME="SalesRegister Details">
    <LEFTFIELDS>PartyLedgerName</LEFTFIELDS>
    <RIGHTFIELDS>Amount,SalesDate,InvoiceNo,GrossRevenue,VoucherKey,VoucherNumber,Field VoucherTypeName,STKName,STName</RIGHTFIELDS>
    <XMLTAG>SalesRegister</XMLTAG>
    </LINE>
    <FIELD NAME="PartyLedgerName">
    <USE>Name Field</USE>
    <SET>$SalesLedgerName</SET>
    </FIELD>
    <FIELD NAME="SalesDate">
    <USE>Name Field</USE>
    <SET>$Date</SET>
    </FIELD>
    <FIELD NAME="InvoiceNo">
    <USE>Name Field</USE>
    <SET>$VoucherNumber</SET>
    </FIELD>
    <FIELD NAME="Amount">
    <USE>Name Field</USE>
    <SET>$AprAmt</SET>
    </FIELD>
    <FIELD NAME="GrossRevenue">
    <USE>Name Field</USE>
    <SET>$GrossRevenue</SET>
    </FIELD>
    <FIELD NAME="VoucherKey">
    <USE>NUMBER</USE>
    <SET>$VoucherKey</SET>
    </FIELD>
    <FIELD NAME="VoucherNumber">
    <USE>NUMBER</USE>
    <SET>$VoucherNumber</SET>
    </FIELD>
    <FIELD NAME="Field VoucherTypeName">
    <USE>Name Field</USE>
    <SET>$VoucherTypeName</SET>
    </FIELD>
    <FIELD NAME="STKName">
    <USE>Name Field</USE>
    <SET>$STKINAME</SET>
    </FIELD>
    <FIELD NAME="STName">
    <USE>Name Field</USE>
    <SET>$BaseUnits:StockItem:#Stkname</SET>
    </FIELD>
    <COLLECTION NAME="AllVoucher" ISMODIFY="No">
    <TYPE>Voucher</TYPE>
    <CHILDOF>$$VchTypeSales</CHILDOF>
    <BELONGSTO>YES</BELONGSTO>
    <FETCH>SVFROMDATE,SVTODATE,VoucherNumber,LedgerName,Date,Amount,VoucherTypeName,Date,RATEDETAILS.List,GSTDetails.List,LedgerEntries.List,AllInventoryEntries.List,Ledger Vouchers</FETCH>
    </COLLECTION>
    <COLLECTION NAME="GetLedgerCollAmt" ISMODIFY="No">
    <SourceCOLLECTION>AllVoucher</SourceCOLLECTION>
    <By>VoucherNumber : $VoucherNumber</By>
    <By>Date : $Date</By>
    <compute>SalesLedgerName :$LedgerName</compute>
    <compute>GrossRevenue :$GrossRevenue</compute>
    <compute>VoucherKey :$VoucherKey</compute>
    <compute>VoucherNumber :$VoucherNumber</compute>
    <compute>VoucherTypeName :$VoucherTypeName</compute>
    <compute>AprAmt : $Amount </compute>

    <AggrCompute>Amount : Sum : $Amount</AggrCompute>
    <Compute>STKINAME:$Stockitem</Compute>
    <FILTERS>Filter_IsSales,Filter_DateRange</FILTERS>
    </COLLECTION>
    <COLLECTION NAME="RTS SVSendRemoteMsgs">
    <TYPE>Voucher</TYPE>
    <FETCH>*.*</FETCH>
    <FETCH>LedgerEntries.*</FETCH>
    <FILTERS>LedgerFilterVal,Filter_IsSales,Filter_DateRange,IsOptionalFilter</FILTERS>
    </COLLECTION>
    <SYSTEM TYPE="Formulae" NAME="LedgerFilterVal">$$IsLedOfGrp:$PartyNameExpEXP:$$GroupSundryDebtors</SYSTEM>
    <SYSTEM TYPE="Formulae" NAME="Filter_DateRange">($Date&gt;=$$Date:##SVFROMDATE) AND ($Date&lt;=$$Date:##SVTODATE)</SYSTEM>
    <SYSTEM TYPE="Formulae" NAME="Filter_IsSales">($$IsSales:$VoucherTypeName)</SYSTEM>
    <SYSTEM TYPE="Formulae" NAME="IsOptionalFilter">NOT $IsOptional</SYSTEM>
    </TDLMESSAGE>
    </TDL>
    </DESC>
    </BODY>
    </ENVELOPE>
     


  16. Sai Vineeth

    Sai Vineeth Member


    this is also a problem with saying use custom reports you are trying re-invent the wheel

    We can achieve what we want with native reports provided by Tally easily with minimum payload
    If I want to fetch Sales Register I simply use
    Code:
    <ENVELOPE>
        <HEADER>
            <VERSION>1</VERSION>
            <TALLYREQUEST>Export</TALLYREQUEST>
            <TYPE>Collection</TYPE>
            <ID>CusSalesVouchers</ID>
        </HEADER>
        <BODY>
            <DESC>
                <STATICVARIABLES>
                    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT> <!-- * Supports only xml format -->
                  <SVViewName>Accounting Voucher View</SVViewName>
                    <SVFROMDATE>{{Fromdate}}</SVFROMDATE>
                    <SVTODATE TYPE="Date">{{ToDate}}</SVTODATE>
                </STATICVARIABLES>
                <TDL>
                    <TDLMESSAGE>
                        <COLLECTION ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No" NAME="CusSalesVouchers">
                            <TYPE>Vouchers</TYPE>
                                <!--Replace Sales with ledgername you want to search -->
                            <Childof>$$VchTypeSales</Childof>
                            <BELONGSTO>YES</BELONGSTO>
                            <NATIVEMETHOD>*</NATIVEMETHOD>
                      
                        </COLLECTION>
    
                    </TDLMESSAGE>
                </TDL>
            </DESC>
        </BODY>
    </ENVELOPE>
    If you ask me how I will parse such complex structure I written a library in c# for that - TallyConnector that makes connecting with Tally easily, In that library I will use a generic function that parses all types of tally objects xml.
     
    saravanan1999 likes this.


  17. saravanan1999

    saravanan1999 New Member


    Thank you for your reply.

    Could you please tell me how to use this in Xml ??
    1. $$loopObjCall
    2.For In(FOR IN : <Iterator Var Name> : <List Var Name> . . END FOR)
    3. ListValue ($$ListValue : <List Var Name> : <Key Formula>)

    And how to add salesman menu inside the Outstanding report????
     
    Last edited: Nov 10, 2021


  18. Sai Vineeth

    Sai Vineeth Member


    To use Tally Functions in XML you need to wrap it inside LOCALFORMULA
    For example to use If else
    Code:
    <LOCALFORMULA>PlanName: If $$LicenseInfo:IsEducationalMode Then "Educational Version" ELSE If $$LicenseInfo:IsSilver Then "Silver" ELSE If $$LicenseInfo:IsGold Then "Gold" else ""</LOCALFORMULA>
     


  19. saravanan1999

    saravanan1999 New Member


    Thanks ji..!!
     
    Sai Vineeth likes this.


  20. saravanan1999

    saravanan1999 New Member


    Hi sir,
    This TDl code how to Export xml format

    [Function: for Each within Function]

    List Variable : GroupName : String

    00 : CALL : For Each List Fill
    10 : LIST VALUE SORT : GroupName : Yes : Logical
    20 : CALL : For Each List Print : "Value - String - Ascending"

    [Function: For Each List Fill]

    Variable : Count : Number

    00 : SET : Count : 1
    10 : WALK COLLECTION : My Group
    20 : LIST ADD : GroupName : ##Count : $Name
    30 : INCREMENT: Count
    40 : END WALK

    [Function: For Each List Print]

    Parameter : SortTypeString : String

    00 : SET FILE LOG ON
    10 : LOG : "---" + ##SortTypeString + "---"

    20 : FOR EACH : KeyVar : GroupName
    30 : LOG : "Key: " + $$String:##KeyVar + " Value: " + $$ListValue:GroupName:##KeyVar
    40 : END FOR

    50 : LOG : "-----------------------------------------------"
    60 : SET FILE LOG OFF

    [Collection: MyGroup]

    Type : Group
    Child Of : $$GroupCurrentAssets
    BelongsTo : Yes
    Fetch : Name

    I Understand this TDL code, but unable to convert xml format Please help..!!

     


  21. Sai Vineeth

    Sai Vineeth Member


    If you have Tally developer License ,You can convert TDL to xml by right clicking TDL and convert to xml TDL
    Since I don't have Developer License I cannot do it
     
    saravanan1999 likes this.


  22. saravanan1999

    saravanan1999 New Member


    Yes but, I also don't have developer licence
     


  23. saravanan1999

    saravanan1999 New Member


    Hello sir,
    I want Sales man wise outstanding report could you send Tdl code Please..!!!
     


  24. Sai Vineeth

    Sai Vineeth Member


    I am not TDL developer so I don't have all those
    But I am sure Someone already shared in this website you can find by searching
     


  25. saravanan1999

    saravanan1999 New Member


    Yes sir,
    I search lot but i am unable to get this one.
    Thank You..!!
     
    Last edited: Nov 16, 2021


Share This Page