XML request to fetch detail of a single company that is loaded in gateway

Discussion in 'Tally Developer' started by Researcher1, Aug 11, 2023.

    
  1. Researcher1

    Researcher1 Member


    The following query fetches details about all the companies that are loaded in the gateway of tally , even after setting the SVCURRENTCOMPANY tag.

    Code:
    <ENVELOPE><HEADER><VERSION>1</VERSION><TALLYREQUEST>Export</TALLYREQUEST><TYPE>Collection</TYPE><ID>Company Collection</ID></HEADER><BODY><DESC><STATICVARIABLES><SVCURRENTCOMPANY>company name</SVCURRENTCOMPANY><SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT></STATICVARIABLES><TDL><TDLMESSAGE><COLLECTION NAME="Company Collection" ISMODIFY="No"><TYPE>Company</TYPE><FETCH>email,TANUMBER,mobileno,fullcompanyaddress,VATTINNUMBER,COUNTRYNAME,PHONENUMBER,STARTINGFROM,BOOKSFROM,STATENAME,PINCODE,incometaxnumber,guid,corporateidentityno,BASICCOMPANYFORMALNAME</FETCH></COLLECTION></TDLMESSAGE></TDL></DESC></BODY></ENVELOPE>
    I want to modify the request so that it fetches the details only about single company that is loaded in gateway .
    If any solution please update.
     


  2. Sai Vineeth

    Sai Vineeth Active Member


    You have 2 options
    Apply filter based on svcurrentcompany and dont set SVCURRENTCOMPANY variable
    or
    filter based on $$CurrentSimpleCompany
    In both cases add System Formula and add filter to collection
    Code:
     <SYSTEM TYPE="Formulae" NAME="TC_IsActiveCompany">$Name = ##SVCURRENTCOMPANY</SYSTEM>
    or
    Code:
    <SYSTEM TYPE="Formulae" NAME="TC_IsActiveCompany">$Name = $$CurrentSimpleCompany</SYSTEM>
    Using first method there is chance of selecting group company,
    In second method its always non group company
     
    Researcher1 likes this.


  3. Researcher1

    Researcher1 Member


    Using the System Formulae and adding filter to collection worked for me . I have used this
    Code:
     <SYSTEM TYPE="Formulae" NAME="TC_IsActiveCompany">$Name = ##SVCURRENTCOMPANY</SYSTEM>
    Thanks for the quick response.
     


  4. Sai Vineeth

    Sai Vineeth Active Member


    Yeah, we need to use defined filter in collection.

    <SYSTEM TYPE="Formulae".../> is just definition
    if we dont use it in collection it won't have any effect
     


Share This Page