Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向Cognos 10基于sql的查询添加条件提示_Sql_Prompt_Cognos_Cognos 10_Cognos Bi - Fatal编程技术网

向Cognos 10基于sql的查询添加条件提示

向Cognos 10基于sql的查询添加条件提示,sql,prompt,cognos,cognos-10,cognos-bi,Sql,Prompt,Cognos,Cognos 10,Cognos Bi,Cognos BI版本:10.2.2使用report studio 我有一个带有一个提示p1的报告,它是一个基于sql查询的报告。 提示用户界面: p1是下拉列表(使用值、显示值) 1-全部,2-值2,3-值3,4-值3 我试图在sql查询中添加基于条件的提示语法 select col1, col2, col3, col4 from table1 where col4 is not null case when #Prompt('p1')# = 1 then ' and 1=1' w

Cognos BI版本:10.2.2使用report studio
我有一个带有一个提示p1的报告,它是一个基于sql查询的报告。
提示用户界面: p1是下拉列表(使用值、显示值)
1-全部,2-值2,3-值3,4-值3

我试图在sql查询中添加基于条件的提示语法

select col1, col2, col3, col4 from table1
where col4  is not null
case when #Prompt('p1')# = 1 then ' and 1=1'
     when #Prompt('p1')# = 2 then ' and col1 is null and col2 is not null'
     when #Prompt('p1')# = 3 then ' and col1 is not null and col2 is null'
     when #Prompt('p1')# = 4 then ' and col1 is null and col2 is null'
end

我尝试在网上使用大量语法搜索,但找不到与我的场景相关的示例。我需要帮助以正确的方式编写声明以满足我的要求。非常感谢任何帮助。

通常我建议您发布错误,但这一错误似乎很明显

select col1, col2, col3, col4 from table1
where col4  is not null
and (
(#Prompt('p1','token','0')# = 1) OR
(#Prompt('p1','token','0')# = 2 and col1 is null and col2 is not null) OR
(#Prompt('p1','token','0')# = 3 and col1 is not null and col2 is null) OR
(#Prompt('p1','token','0')# = 4 and col1 is null and col2 is null)
)

你的问题是?对不起。我试图在网上使用大量的语法搜索,但找不到与我有关的例子。我需要帮助,以达到正确的方式写的声明,以满足我的要求。我做了一些网上搜索。遇到了下面的宏语法,这很有帮助#提示符('name','datatype','default','pretext','source','posttext')#。我尝试插入我的代码并尝试这样做#提示符('p1','string','1','1','1=1')#,它给我RQP-DEF--177错误sqlprepareoptions status=9。。语法非常混乱..我修改了答案-这应该使提示成为可选的。是的,语法非常混乱!