简体   繁体   English

尽管提供了适当的图表数据设置/选项,Crystal Report饼图仍显示相同的onchange值

[英]Crystal Report pie chart showing same value for onchange despite giving proper chart data settings / options

I have a list of categories and their respective counts. 我列出了类别及其各自的数量。 OnChange of Category, the count for that respective category must be shown in the Crystal report Pie Chart. 在类别更改时,该相应类别的计数必须显示在Crystal报表饼图中。 It is a simplest pie chart but it shows correct in the preview but not in runtime. 它是最简单的饼图,但在预览中显示正确,但在运行时显示不正确。 At runtime, all the slices of the pie chart are equally divided into the number of categories instead of being proportional to the value of the count column against each category column value of my report dataset table. 在运行时,饼图的所有切片均被划分为类别数,而不是与计数列的值相对于报表数据集表中每个类别列的值成比例。

I used OnChange of - Category, show values - sum of Count. 我使用的是-类别的OnChange,显示值-Count的总和。 As that is the generic way of doing this. 因为这是执行此操作的通用方法。

I made sure that count is a number in the xsd being used as datasource by the report. 我确保count是报表中用作数据源的xsd中的数字。 But still the pie chart was an equally divided pie at runtime :( 但是饼图在运行时仍然是等分的饼图:(

After hours of trying, figured out a way to solve this jinx. 经过数小时的尝试,找到了解决此难题的方法。 Use a formula. 使用公式。 Just declare a number variable. 只需声明一个数字变量。 Assign the value of the count column to this variable and then onchange of Category Show values of this formula instead of the column 'count' from xsd. 将count列的值分配给该变量,然后在更改此公式的Category Show值时,而不是xsd中的“ count”列。

I created a formula by some name, say MyFormula. 我用一个名字创建了一个公式,例如MyFormula。 Logic in formula as below - numbervar nv:= tonumber({MyXSDTable.Count}); nv 公式中的逻辑如下numbervar nv:= tonumber({MyXSDTable.Count}); nv numbervar nv:= tonumber({MyXSDTable.Count}); nv

Note - XSDTableName.columnname can be dragged and dropped in the Formula editor. 注意-XSDTableName.columnname可以在“公式”编辑器中拖放。 In my case, count column of my XSD was the report field I wanted to make numeric, using this formula. 在我的情况下,我的XSD的count列是我想使用此公式将数值设为报告字段。

Now in the Chart Expert, in the Data tab, OnChange of Category, show values of @MyFormula. 现在,在“图表专家”的“​​数据”选项卡的“类别的OnChange”中,显示@MyFormula的值。

Voila problem solved. 瞧,问题解决了。 Pie chart finally recognises the different counts and shows proper proportionate slices instead of showing equally sized slices. 饼图最终识别出不同的计数,并显示适当比例的切片,而不是显示大小相等的切片。

(Previously, though the slices were equal to the no of categories I had in my report details rows, the slice ie quadrants size in the pie chart was not reflecting the count value against each category. But after using formula and reassigning value of count to a numeric variable, the pie chart works fine.) (以前,虽然切片等于我报表详细信息行中的类别编号,但切片(即饼图中的象限大小)并未反映每个类别的计数值。但是在使用了公式并将计数值重新分配给一个数字变量,则饼图可以正常工作。)

I think I should give credit to this unrelated discussion I found on SAP Crystal Report Forum. 我想我应该给予信贷这个无关的讨论中,我对SAP水晶报表论坛找到。 Got a clue from there and I used part of their solution to solve my problem. 从那里得到了一个线索,我使用了他们的解决方案的一部分来解决我的问题。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM