SQL 用字段表中的另一个字符串替换字符串的水晶报表语法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20123449/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Crystal Report Syntax for replace string with another string in field table
提问by user3017891
I am quite new so I apologize beforehand. I am in Crystal Reports v.11 and I am needing to do a type of string alias. For example: Within table 1 has two field names where I need to convert from 'A' to 'B'.
我很新,所以我事先道歉。我在 Crystal Reports v.11 中,我需要做一种字符串别名。例如:在表 1 中有两个字段名称,我需要将它们从“A”转换为“B”。
I've tried several syntax's and none work:
我尝试了几种语法,但都不起作用:
ToText({table_name},"A","B")
if {table_name}='A' then 'B' else {table_name}
if {table_name}='A' then 'B' else ""
Replace({table_name},"A","B")
*error message "A boolean is required here."
ToText({table_name},"A","B")
if {table_name}='A' then 'B' else {table_name}
if {table_name}='A' then 'B' else ""
Replace({table_name},"A","B")
*错误消息“此处需要一个布尔值。”
Please help! Thank you.
请帮忙!谢谢你。
回答by campagnolo_1
Try:
尝试:
WhilePrintingRecords;
StringVar ReplaceString;
ReplaceString := Replace ({table_Name}, "A", "B");
ReplaceString
Now, if you get a boolean error than you need to let us know what type of field you are dealing with.
现在,如果您收到布尔错误,您需要让我们知道您正在处理的字段类型。
回答by craig
If you are trying to create a table alias, you need to do so in the Database Expert. Once there select the desired table, hit F2
, then modify the name as desired?
如果您尝试创建表别名,则需要在数据库专家中进行。一旦选择了所需的表,点击F2
,然后根据需要修改名称?