0

我在水晶报表中编写自定义函数以使用记录选择获取记录时感到困惑。

当我们在记录选择中创建公式时,它将根据使用的参数在生成的 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)

提前致谢。

4

1 回答 1

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} )
于 2013-09-02T14:15:46.770 回答