【问题标题】:Crystal Reports Formula Variable PassingCrystal Reports 公式变量传递
【发布时间】:2013-03-11 20:04:02
【问题描述】:

我正在处理此报告,以显示按月份分组的所有预计采购量(当月称为 "Monthly_Total" 并显示预算(当月称为 "Monthly_Budget")。我还有一个子报告我使用共享货币变量"Starting_Balance"。每当运行报告时,此共享变量都会更新。 我需要找到一种方法来进行以下计算:

第一个月(在这种情况下,报告从 3 月开始)应该是

"Starting_Balance" + "Monthly_Total") - "Monthly_Budget" = "New_Balance"

接下来的每个月份都会使用该公式

("New_Balance" + "Monthly_Total") - "Monthly_Budget"

我可以让它为第一个组页脚工作,但之后每个月都会引用 "Starting_Balance" 而不是 "New_Balance"

有什么想法吗?

【问题讨论】:

    标签: crystal-reports formula


    【解决方案1】:

    尝试使用一个标志变量来说明第一个月是否已报告。我最初想将 New_Balance 设为 0,但这可能会自然发生。

    所以,像

    报表头中的初始化器:

    WhilePrintingRecords;
    Global BooleanVar First_Month_Done := false; // have we printed the first month?
    ""; // print nothing on screen
    

    每月公式

    WhilePrintingRecords;  // Optional when using shared variables
    Global BooleanVar First_Month_Done;
    Global CurrencyVar New_Balance;  //or whatever it is
    Shared CurrencyVar Starting_Balance;
    // Assuming "Monthly_Total" and "Monthly_Budget" are formulas, not variables
    
    If First_Month_Done
        Then New_Balance := New_Balance + {@Monthly_Total} - {@Monthly_Budget}
        Else New_Balance := Starting_Balance + {@Monthly_Total} - {@Monthly_Budget};
    
    First_Month_Done := true;
    New_Balance
    

    【讨论】:

    • 这正是我想要的。感谢您结束了我为期两周的头痛!
    猜你喜欢
    • 2010-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多