FastReport VCL程序员手册:使用变量列表

变量的概念在相应的章节中进行了详细说明。让我们简短地提醒大家要点。

用户可以在 告中指定一个或多个变量。可以为每个变量分配一个值或表达式,当引用一个变量时将自动计算出该值或表达式。变量可以通过“数据树”窗口直观地插入到 表中。将变量用于复合表达式的别名非常方便,而复合表达式经常在 表中使用。

使用变量时,必须使用“ frxVariables”单元。变量由TfrxVariable类表示。

  TfrxVariable = class(TCollectionItem)  published    property Name: String; // Name of a variable    property Value: Variant; // Value of a variable  end;

变量列表由TfrxVariables类表示。它包含使用列表所需的所有方法。

  TfrxVariables = class(TCollection)  public    // Adds a variable to the end of the list    function Add: TfrxVariable;    // Adds a variable to the given position of the list    function Insert(Index: Integer): TfrxVariable;    // Returns the index of a variable with the given name    function IndexOf(const Name: String): Integer;    // Adds a variable to the specified category    procedure AddVariable(const ACategory, AName: String; const AValue: Variant);    // Deletes a category and all its variables    procedure DeleteCategory(const Name: String);    // Deletes a variable    procedure DeleteVariable(const Name: String);    // Returns the list of categories    procedure GetCategoriesList(List: TStrings; ClearList: Boolean = True);    // Returns the list of variables in the specified category    procedure GetVariablesList(const Category: String; List: TStrings);    // The list of variables    property Items[Index: Integer]: TfrxVariable readonly;    // Values of variables    property Variables[Index: String]: Variant; default;  end;

如果变量列表很长,则按类别将其分组很方便。例如,当具有以下变量列表时:

Customer nameAccount numberIn totalTotal vat

可以用以下方式表示它:

Properties  Customer name  Account numberTotals  In total  total vat

有以下限制:

  • 至少必须创建一个类别
  • 类别构成数据树的第一层,变量构成第二层
  • 类别不能嵌套
  • 变量的名称在整个列表中必须是唯一的,而不是在类别中

如果您对FastReport感兴趣,欢迎加入FastReport QQ交流群:801349317

还想要更多吗可以点击阅读【FastReport 表2020最新资源盘点】查找需要的教程资源。让人兴奋的是FastReport .NET正在 火热销售中!>>查看价格详情

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年4月8日
下一篇 2021年4月8日

相关推荐

发表回复

登录后才能评论