VFP 8.0报表总页数可以通过数据分组重置吗?
我有一份报告(使用 VFP 8.0),其中数据按发票编号分组,我需要通过更改发票编号来重置总页数。
我没有这样做,因为 _pagetotal 将始终返回所有选定发票的总页数。
请指教。
I have a report (using VFP 8.0) with a data grouping by Invoice Number, i need to reset the total of pages by changing of invoice number.
I failed to do so, as the _pagetotal will always return total pages of all selected invoice.
Please advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据描述,您想要的似乎是我之前的评论...每张发票都有自己的第 X 页(共 Y 页)上下文,其中某些“组”比其他“组”拥有更多页面。要执行您想要的操作,通常需要生成两次报告。运行一次并捕获每组末尾有多少页。第二个实例是“最终”实例。以下是有关如何执行此操作的简单示例。
创建查询结果,但将附加列“OfPages”(或任何您想要表示每个“组”页面计数的列)添加到读写游标中。
接下来,在您的程序中,有一个函数可以“捕获”组页脚处的页码,无论您当前的 ID 是什么。
现在,诀窍。在您的报告中,包含基于发票 ID 的数据组。在组标题中,您将使用 _pageno 和光标的“ofPages”列,而不是使用 _pageno 和 _pagetotal 执行第 x 页,共 y 页...因为第一遍将通过上面的函数调用更新其正确的值,第一次生成报告时设置,但没有输出窗口或打印机,只是在后台运行。
现在,在 FOOTER 组的底部,添加一个文本框控件(就像任何其他数据字段输出一样),并设置其 Expression = 使用相应参数的函数调用...例如:
它将更新临时游标(或您的结果表)及其最后一页的实际页码是什么,并更新关联发票 ID 组的所有记录,因此即使第 1 页也知道其 OfPages = 2、3、4 或其他内容。
要隐藏/屏蔽报表的第一个实例,使其不被看到,请将其隐藏在另一个窗口中,例如
然后将报表进行正常输出。
Based on the description, it appears what you want is per my earlier comment... Each invoice has its OWN Page X of Y context where some "groups" have more pages than others. To do what you want typically requires the report to be generated TWICE. Once to run and capture the how many pages at the end of each group. The second instance is the "FINAL". The following is a simple sample on how to do such.
Create your query results, but add an additional column "OfPages" (or whatever you want to represent the per "group" Of Pages count) into a readwrite cursor.
Next, in your program, have a function to "catch" the page number at the group footer for whatever your current ID is.
Now, the trick. In your report, have your data group based on the ID of the invoice. In the group header, instead of doing page x of y using _pageno and _pagetotal, you will be using _pageno and the column "ofPages" of the cursor... As the first pass will get its proper value updated via the function call above and is set the first time the report is generated but to no output window or printer, just run in the background.
Now, in the group FOOTER, at the bottom, add a textbox control (just as if any other data field output), and set its Expression = the function call with the respectible parameters... ex:
It will do the update to the temp cursor (or your result table) with whatever its actual page number is for that final page to the group, and update all records for the associated invoice ID Group, so even page 1 knows its OfPages = 2, 3, 4, or whatever.
To hide / mask the first instance of the report from being seen, hide it in ANOTHER Window, such as
THEN do your report to normal output.