我很困惑在水晶报告中编写自定义功能以使用记录选择来获取记录。
当我们在记录选择中创建公式时,它将根据使用的参数在生成的SQL-Query中添加where子句。现在我想编写自定义公式,它将以编程方式提取记录:
即使我写了一个函数:
Function (stringVar st)(
stringVar selection;
if (st <> 'ALL') then (
selection = st;
)
else(
//In this case the user select only single value, it will fetch the result to that //particular column value in the table.. otherwise it leaves that particular row..
selection = "multiple selection";
)
)
现在使用select expert在记录选择中使用自定义函数的代码是:
if(myfunction({?parameter1}) <> "ALL") then
(
// what code should i write to select that particular record...
if(myfunction({?parameter2})) <> "ALL" ) then
(
//do selection from the previously selection of rows which have this parameter
if(myfunction({?parameter3}) <> "ALL") then
(
//do selection from the previously selection of rows which have this
//parameter
)
else (//do something else)
)
else (//do something else)
)
else (//do something else)
提前谢谢。
答案 0 :(得分:0)
您不需要自定义功能。假设你有两个字符串参数,ry:
// assumes you have a parameter value of 'All Countries' w/ a value of '0'
( '0' IN {?CountryCodes} OR {table.CountryCode} IN {?CountryCodes} )
// assumes you have a parameter value of 'All Regions' w/ a value of '0'
AND ( '0' IN {?RegionCodes} OR {table.RegionCode} IN {?RegionCodes} )