How can I specify which field to take the data from depending on the value of another field

edited 8:55AM in FastReport 4.0
Hi
I am just trying out fast reports using Delphi 7 and was wondering if it is possible to specify which field in a table to take the data from depending on the value of another field.

For example
I have created a basic report with 3 output fields on it. Name, Description, Avalue
I connect it to a database table etc, What I want to do is when the report is shown to be able to look at another field in the database table and check the value of it, if the value is true put contents of one of the table fields into the Avalue report field if False put another fileds contents into the AValue report field.

Like -
IF (table1.fieldbyname('fieldA').asbool then
report field := table1.fieldbyname('fieldB').asString
else
report field := table1.fieldbyname('fieldC').asString;

I hope this makes some sort of sense

Any help would be greatfully received


Meee






Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:55AM
    in the report script write code in the masterband's obp event to change the text of the memo.
    ie
    if <datasetname."fieldname"> = True then memo1.text := '[datasetname."fieldname1"]' else memo1.text := '[datsetname."Fieldname2"]';
  • edited 8:55AM
    thanks for the help

    Also one more thing I need to access some varibles from inside the report events that are stored in another form in the project, could you tell me where I would put the uses clause to in the script

    thanks

    meee
  • gpigpi
    edited 8:55AM
    Use in Delphi
    frxReport1.Script.AddForm(Form2);
    in TfrxMemoView
    [Form2.Edit1.Text]
  • edited 8:55AM
    gpi wrote: »
    Use in Delphi
    frxReport1.Script.AddForm(Form2);
    in TfrxMemoView
    [Form2.Edit1.Text]


    Thanks

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.