Advice on how to display a calculated field please?

hsmhsm
edited January 2011 in FastReport 4.0
Please can somebody advise me as I'm not completely clear on the documentation.
I have a simple banded report containing six text boxes on each row that display numeric data from a database.
I want to add a seventh text box to display a string whose value depends upon the other six items on that row.

I can do the logic and have prototyped a function to give me the correct string. What I don't know however is...

1) How do I refer to the data in the boxes - what syntax do I use and do I use the db field names or the report's text object names?

2) Where exactly should I write my function?

3) How do I get the seventh text box to refer to the function so as to display the result of my function?

I'd be very grateful if somebody could help me out with a simple example
eg
if textbox1 contains field1 from data set dsMain and textbox2 contains field2 from dataset dsMain, how would I make textbox3 display 'yes' if the contents of textbox2 is greater than the contents of textbox1 and 'no' otherwise?

Howard

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:37PM
    in textbox 3 write an expression using the iif function provided
    [iif((<datasetname."fieldname2">) > (<datasetname."fieldname1">),'Yes', 'No')]
  • hsmhsm
    edited 1:37PM
    gordk wrote: »
    in textbox 3 write an expression using the iif function provided
    [iif((<datasetname."fieldname2">) > (<datasetname."fieldname1">),'Yes', 'No')]

    Ah, thank you, I was trying to do it all in Pascal, putting the function in the 'code' part.
    I also didn't appreciate I had to use sql type syntax.
    Thanks for clarifying how you refer to things as well, I was getting a bit confused between the field name and the name of the textobject.

    I'll give it a go, extrapolated up to six objects.
    Howard

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.