Crystal Reports - 用于遍历数据库字段数组的do循环

时间:2018-02-01 23:24:38

标签: crystal-reports

尝试使公式计算子报表中的字符串,代码如下所示

shared StringVar array aflProc := [{V_APS_ATTRIB.TITLE_1},{V_APS_ATTRIB.TITLE_2},{V_APS_ATTRIB.TITLE_3},{V_APS_ATTRIB.TITLE_4},{V_APS_ATTRIB.TITLE_5},{V_APS_ATTRIB.TITLE_6},{V_APS_ATTRIB.TITLE_7},
{V_APS_ATTRIB.TITLE_8},{V_APS_ATTRIB.TITLE_9},{V_APS_ATTRIB.TITLE_10},{V_APS_ATTRIB.TITLE_11},{V_APS_ATTRIB.TITLE_12},{V_APS_ATTRIB.TITLE_13},{V_APS_ATTRIB.TITLE_14},{V_APS_ATTRIB.TITLE_15},{V_APS_ATTRIB.TITLE_16},{V_APS_ATTRIB.TITLE_17},{V_APS_ATTRIB.TITLE_18},{V_APS_ATTRIB.TITLE_19},{V_APS_ATTRIB.TITLE_20},{V_APS_ATTRIB.TITLE_21},{V_APS_ATTRIB.TITLE_22},{V_APS_ATTRIB.TITLE_23}];
shared StringVar aflProc2;
local numberVar i;


    For i := 1 to 23 do (
        if aflProc[i] <> "" Then
        aflProc2 := aflProc2 & chr(10) & aflProc[i]
        else aflProc2
    );

aflProc2;

尝试了几种不同的方法,任何关于如何让我的公式从db字段表输出字符串的建议都会有所帮助。

谢谢

1 个答案:

答案 0 :(得分:0)

删除else aflProc2

并删除最后的aflProc2;,然后从顶部的数组中删除换行符,这可以正常工作