Rave Reports 8 中的字符串问题

发布于 2024-09-03 15:04:00 字数 1480 浏览 4 评论 0原文

我们目前正在使用 Delphi 2006,但我们现在非常准备好转向 Delphi 2010。

问题出在我们的 Rave 报告中......

我们在运行我们的程序时遇到了许多字符串错误Rave 8 的报道。它们根本没有任何意义。 (报告编译时没有错误,我们甚至可以在 Rave 6 中运行它们而不会出现任何错误。)

更新: 错误发生在报告本身的事件脚本内。这些错误与字符串和字符串连接有关。

例如:

//This event causes access violation (in rtl140.bpl) at run time
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s)) + ' and then some more';           //<-- This line causes AV
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;


//This event works OK
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s));                                   //<-- This line is OK
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;


//This event works OK too
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s)) + s;                               //<-- This line is OK
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;

我们真的想坚持使用 Rave,因为我们有很多报告(150 多个)和很多功能(sql 语句、事件等)。此外,我们还有设计自己的定制报告的客户。

有谁知道这些错误的原因吗?
对于这些问题有什么解决方案或解决方法吗?

We are currently working with Delphi 2006, but we are now very ready to move on to Delphi 2010.

The problem lies in our Rave reports, though...

We just get to many string errors when running our reports with Rave 8. And they just don't make any sense. (The reports compile with no error, and we can even run them without any error in Rave 6.)

Update:
The errors occurs inside the event scripts in the reports itself. The errors are related to strings and string concatenation.

For instance:

//This event causes access violation (in rtl140.bpl) at run time
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s)) + ' and then some more';           //<-- This line causes AV
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;


//This event works OK
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s));                                   //<-- This line is OK
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;


//This event works OK too
{ Event for Page1.OnBeforeReport }
function Page1_OnBeforeReport(Self: TRavePage);
var
  s: String;
begin
  s := 'My text in param';
  s := s + ' and som more text';
  s := copy(s,1,length(s)) + s;                               //<-- This line is OK
  RaveProject.SetParam('MyTestParam', s);
end OnBeforeReport;

We really want to stick to Rave, because we have a lot of reports (150+) with a lot of functionality (sql statements, events etc). Besides, we have customers who have designed their own custom reports as well.


Does anybody know the reason for these errors?
Is there any solution or workaround to these problems?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

檐上三寸雪 2024-09-10 15:04:00

真是太意外了,我昨天也做了同样的事情。 20 份报告中的 19 份工作正常。其中的问题是使用 SetParam 和 DataMemo 且 ContainsRTF = True 的脚本。

我对 SetParam 的解决方案是将其替换为数据集中的计算字段。对于 ContainsRTF = True 的 DataMemo,除了将 ContainsRTF 切换为 False 之外,我没有找到其他解决方案(但我很幸运,RTF 并不是真正需要的)

What an accident, I do the same thing yesterday. 19 from 20 reports work fine. The problem with the one was a script using SetParam and DataMemo with ContainsRTF = True.

My solution for SetParam was to replace it with calculated fields in my DataSet. For DataMemo with ContainsRTF = True I found no solution other than switching ContainsRTF to False (but I am lucky, RTF wasn't really needed)

放手` 2024-09-10 15:04:00

自 Delphi 2009 以来,Unicode 已成为默认的字符串编码,因此当您声明 String var 时,您将获得 Unicode 字符串而不是 Ansi 字符串。
没有办法改变默认行为(这是大量难以发现的错误和更难修复的错误的根源)。
如果问题出在源代码上,您可以尝试将字符串编码显式更改为 ANSI,而不是使用默认值。
如果问题来自于使用 Rave 编辑器创建的报告,我们发现的解决方法是使用旧版本的 Rave(7.5 之前的版本)编译报告,这似乎工作正常。

Since Delphi 2009 Unicode has become the default string encoding, so when you declare a String var you're getting a Unicode String instead of an Ansi String.
There's no way to change the default behaviour (which has been the source of a great deal of hard-to-find-bugs and harder-if-no-impossible-to-fix ones).
If the problem comes from your source code you can try explicitly changing the string encoding to ANSI instead of using the default.
If the problem comes from the reports created with the Rave Editor, a workaround we found was to compile the reports with an older version of Rave (prior 7.5), which seems to work fine.

他夏了夏天 2024-09-10 15:04:00

这是一个无可救药的 unicode 问题,从 7.5 版本开始就一直存在。

This is an incorrigible unicode problem that has been around since version 7.5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文