Crystal Report选择字段 [英] Crystal Report Select Fields

查看:63
本文介绍了Crystal Report选择字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b我有一份Crystal报告,其中包含



OrderNo客户金额

* 0553 Ron 150.0

2635伯特50.0

* 4231詹姆斯70.0

总计270.0






我如何获得所有金额的总金额/总和而不包括包含''*'的订单号

我已尝试使用LIKE但我无法得到结果



我使用了一个公式总和




如果不是({Amount}喜欢*)那么

SUM(金额)

Hi I have a Crystal Report which have

OrderNo Customer Amount
*0553 Ron 150.0
2635 Bert 50.0
*4231 James 70.0
Total 270.0



How can I get the total/SUM of all Amount without including the Order No that contains ''*''
I have have try using the LIKE but I can''t get the result

I''ve used a formula sum


IF NOT ({Amount} like "*") THEN
SUM(Amount)

推荐答案

当我看到什么你使用的代码,我立刻认为你没有使用LIKE正确的方法。使用LIKE时,通常会包含通配符。例如,当搜索以字母M开头的内容时,你会按照以下几行写一些内容: {Name} LIKEM%。百分号是外卡字符,表示任何值的任意数量的字符都可以在其后面。如果您写了 {Name} LIKE%M,它将返回以字母M结尾的值。



但这不是你的整个问题。百分号在很多SQL语言中用作通配符,但似乎在Crystal Reports中通配符是星号。



所以当你说 {Amount} LIKE*你实际上要求它返回一切。我做了一些谷歌搜索,我发现其他人有同样的问题,但没有关于最佳解决方案的很多答案。 此处 [ ^ ]是我能找到的最好的。我以为你可以玩游戏并尝试使用转义字符来表示你想要搜索星号而不是用它作为通配符,它​​可能看起来像这样:

{Amount} LIKE/ **。 (斜线表示下一个字符不应该被视为特殊字符或通配符。第二个星号用作通配符,因此它将返回带有星号的任何STARTS。)但我不确定Crystal Reports是否使用转义字符。你可以做更多的研究来找出答案。



祝你好运。
When I saw what code you used, I immediately thought you were not using the LIKE the correct way. When you use a LIKE, you would usually include a wildcard character. For example, when searching for things that start with the letter M, you''d write something along these lines: {Name} LIKE "M%". The percent sign is a wild card character that means any number of characters of any value can come after it. If you wrote {Name} LIKE "%M" it would return values that ended in the letter M.

This, however is not your entire problem. The percent sign is used in a lot of SQL languages to be the wildcard character, but it seems that in Crystal Reports the wildcard character is the asterisk.

So when you say {Amount} LIKE "*" you are actually asking it to return EVERYTHING. I did some googling and I''ve found other people with the same issue but not a whole lot of answers as to the best solution. Here[^] is the best I could find. I thought you could play around and try to use an escape character to signify that you want to search for an asterisk and not use it as a wildcard, which might look something like this:
{Amount} LIKE "/**". (The slash says the next character shouldn''t be treated as a special character or wildcard. The second asterisk IS used as a wildcard so it will return anythign that STARTS with an asterisk.) But I''m not sure if Crystal Reports uses escape characters. You could probably do somemore research to find out.

Good luck.


这篇关于Crystal Report选择字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆