英文:
Is there a way to extract all the stock items from Tally Group/Category including the items inside sub-group with Tally XML request?
问题
获取所有库存项目及其数量、价格和别名/零件号的Tally XML请求,从指定的组/类别以及该组/类别下的库存项目中。
我尝试通过在<STATICVARIABLES>
中将<EXPLODE>
设置为YES来修改以下代码。
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>maincol</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES/>
<TDL>
<TDLMESSAGE>
<COLLECTION ISINTERNAL="No" ISOPTION="No" ISINITIALIZE="No" ISFIXED="No" ISMODIFY="No" NAME="maincol">
<Type>stock item</Type>
<Method>Name:$name</Method>
<Method>parent:$parent</Method>
<Filters>test</Filters>
</COLLECTION>
<SYSTEM ISINTERNAL="No" ISFIXED="No" ISMODIFY="No" NAME="test" TYPE="Formulae">$parent="Tes" </SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
//但这无法获取子组内的库存项目
我还尝试使用以下代码获取子项目:
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>STOCKGROUPSUMMARY</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML_WithAlias</SVEXPORTFORMAT>
<SVFROMDATE>${formattedDate}</SVFROMDATE>
<SVTODATE>${formattedDate}</SVTODATE>
<SVCompany>${companyName}</SVCompany>
<STOCKGROUPNAME>${stockGroupName}</STOCKGROUPNAME>
<STOCKCATEGORY>${stockGroupName}</STOCKCATEGORY>
<ISITEMWISE>YES</ISITEMWISE>
<EXPLODEFLAG>YES</EXPLODEFLAG>
<DSPALIASNAME>Yes</DSPALIASNAME>
<DSPALIAS>Part Number</DSPALIAS>
<DSPZEROQTY>Yes</DSPZEROQTY>
<INCLUDEZEROSTOCK>Yes</INCLUDEZEROSTOCK>
<NativeMethod>*</NativeMethod>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
//但不能获取零数量项目,并且无法获取别名/零件号
英文:
Tally XML request to get all stock items with their quantity, rate, and alias name/part number from the mentioned group/category and the stock items under that group/category.
I have tried to modify the following code by setting <EXPLODE>
to YES in <STATICVARIABLES>
.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>maincol</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES/>
<TDL>
<TDLMESSAGE>
<COLLECTION ISINTERNAL="No" ISOPTION="No" ISINITIALIZE="No" ISFIXED="No" ISMODIFY="No" NAME="maincol">
<Type>stock item</Type>
<Method>Name:$name</Method>
<Method>parent:$parent</Method>
<Filters>test</Filters>
</COLLECTION>
<SYSTEM ISINTERNAL="No" ISFIXED="No" ISMODIFY="No" NAME="test" TYPE="Formulae">$parent="Tes" </SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
//But this fails to fetch stock items inside sub-group
I have also tried using the following code which gets the sub-items
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>STOCKGROUPSUMMARY</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML_WithAlias</SVEXPORTFORMAT>
<SVFROMDATE>${formattedDate}</SVFROMDATE>
<SVTODATE>${formattedDate}</SVTODATE>
<SVCompany>${companyName}</SVCompany>
<STOCKGROUPNAME>${stockGroupName}</STOCKGROUPNAME>
<STOCKCATEGORY>${stockGroupName}</STOCKCATEGORY>
<ISITEMWISE>YES</ISITEMWISE>
<EXPLODEFLAG>YES</EXPLODEFLAG>
<DSPALIASNAME>Yes</DSPALIASNAME>
<DSPALIAS>Part Number</DSPALIAS>
<DSPZEROQTY>Yes</DSPZEROQTY>
<INCLUDEZEROSTOCK>Yes</INCLUDEZEROSTOCK>
<NativeMethod>*</NativeMethod>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
//but does not get the items with zero-quantity and fails to get alias names/part number
答案1
得分: 1
第一个 XML 对于你的情况最合适,因为你可以简单地在集合内部添加字段列表。
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>maincol</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVFROMDATE TYPE="Date">01-04-2010</SVFROMDATE>
<SVTODATE TYPE="Date">31-03-2011</SVTODATE>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<COLLECTION ISINTERNAL="No" ISOPTION="No" ISINITIALIZE="No" ISFIXED="No" ISMODIFY="No" NAME="maincol">
<Type>StockItem</Type>
<CHILDOF>Tes</CHILDOF>
<BELONGSTO>Yes</BELONGSTO>
<FETCH>Name,parent,OpeningRate</FETCH>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
"Tes" - 是组名(可以更改为你想要的名字,应该存在于 Tally 中)
如果你想要嵌套项(子组内的库存项目),则将 BelongsTo 设置为 Yes,否则你可以移除它或设置为 No
*在获取列表内添加所需的方法,而不是在方法内添加。
英文:
First xml works best for your case as you can simply add fields list inside collection
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>maincol</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVFROMDATE TYPE="Date">01-04-2010</SVFROMDATE>
<SVTODATE TYPE="Date">31-03-2011</SVTODATE>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<COLLECTION ISINTERNAL="No" ISOPTION="No" ISINITIALIZE="No" ISFIXED="No" ISMODIFY="No" NAME="maincol">
<Type>StocKItem</Type>
<CHILDOF>Tes</CHILDOF>
<BELONGSTO>Yes</BELONGSTO>
<FETCH>Name,parent,OpeningRate</FETCH>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
Tes - is group name(can be changed to name you want should exist in Tally)
BelongsTo is set to yes, if you want nested items (stock items inside sub-group) else you can remove that or set to No
*Add required methods inside fetch list not in method
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论