Problem statement: Tally is a hierarchical database with a desktop application. In order to refresh the mobile apps one needs to sync the data with a nosql or relational database. The issue is how to do the incremental refresh.
Using the standard Tally XML export: Tally can export any report in the xml format. For example the Daybook can be exported using the following xml code.
The given xml request assumes that Tally is been used as a webserver
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Daybook</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
The output of the same shall give a complete list of masters and transactions.
However there could be a need to only get transactions in the load. In such a scenario the following set of sample collections export could be used.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>salesVouchers</ID>
</HEADER>
<BODY>
<DESC>
<TDL>
<TDLMESSAGE>
<COLLECTION NAME="salesVouchers"IsModify="No">
<TYPE>Voucher</TYPE>
<FETCH>*.*</FETCH>
<COMPUTE>FOREXTRANSACTION_rohit:$$FOREXVALUE:$AMOUNT</COMPUTE>
<COMPUTE>Ledgeramount:$$COLLECTIONFIELD:$AMOUNT:1:ALLLEDGERENTRIES</COMPUTE>
<COMPUTE>HsnIgstRate_ledger:If $$IsEmpty:$.GSTOVRDNRate Then $$GetInfoFromHierarchy:$ledgername:"ledger":"GSTRate":$date:"GST":0:@@IGSTDutyHead Else $.GSTOVRDNRate</COMPUTE>
<SYSTEM Type="Formulae" NAME="opfilter">$$ISSALES:$VOUCHERTYPENAME</SYSTEM>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
After the extract was done in json files, the details were joined using sql joins using the composite keys companyname, masterid and so forth.
b.) Converting the heirarchial functions to SQL joins: The sql joins are atleast 70% faster than the heirarchial functions in terms of speed and consume atleast 50% less memory than the functions. The same concept was used in the database level and the Powerbi module to speed up the querying process.
Reducing the time to extract: Our team developed a datawarehouse and thereby captured the incremental data load using the form accept events for masters and vouchers in Tally. This would further speed up the extraction process.
Sample code:
For example for the masters the incremental data load logic could be as follows:
[Collection: Group_Crash]
Type: Group
Filter:MASTER_FILTER_Groupfilter
Fetch : Parent,ParentHierarchy,Masterid,Alterid,Isrevenue,Affectsstock,AffectsGrossprofit,Reservedname,Reservename+
,Issubledger,Istdsapplicable,Istcsapplicable,isbillwiseone,iscoscentreson,Istdsexpense,istcsapplicable,Isdeemedpositive
Compute :Area :$_Area
Compute :PrimaryGroup :$_PrimaryGroup
Compute :CompanyName :##SVCurrentCompany
Compute: Groupname: $Name
;select $Name,$Parent,$Area,$ParentHierarchy,$PrimaryGroup,$Masterid,$Alterid from Group_crash
[#SYSTEM:FORMULAE]
MASTER_FILTER_Groupfilter: $$String:$Name=$$String:#MSTNAME
Here #MSTname is the name associated with the group name in the Group form.
Similarly for voucher:
[#Form:VOUCHER]
On:Form Accept:Yes:FORM ACCEPT
On:Form Accept:Yes:Call:MasterFunction_Transaction
The voucher collection would include a statement like:
[collection:VoucherDetails]
Type:Voucher
;Parm Var: svfromdate: Date:$$Date:@@machinedate-30
;Parm Var: svtodate:DATE: $$Date:@@machinedate
FILTER:MASTER_FILTER_VOUCHER
where the MASTER_FILTER_VOUCHER is as follows:
[#SYSTEM:FORMULAE]
MASTER_FILTER_VOUCHER: $Date=#plainvchdate and $$String:$Vouchernumber=$$String:#VCHNUMBER
Reducing the data load transferred from the system to the cloud: this was done through incremental data load and through data compression achieved through Powerbi module. If a SQL Server instance instance is installed then the speed is quicked by having api request with a single table.
The above approaches can be considered for the initial and incremental data load from Tally to the cloud.
Name: Apoorv Chaturvedi
Phone:+91-8802466356
email:support@turbodatatool.com;support@mndatasolutions.com
youtube channel:@mndatasolutions2042.
Indiamart place:https://www.indiamart.com/mnbusinessintelligenceindia/