Add values of evaluating fields

HedleyHedley Peru
edited 4:44AM in FastReport 4.0
sorry by my english... and i am new in this...

i need to count values of multiples fields
and i do that

[IIF(<alum1m."AS1"> = 'NS',1,0)] + [IIF(<alum1m."AS2"> = 'NS',1,0)]

but i obtained 0 + 1 insted 1 as number... what i do wrong...

thanks

Hedley

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 4:44AM
    read about the displaying expressions with the help of the text object, in the creating reports section of the use manual.
    when you work in a memoview [] tells the engine to calc the value contained inside the braces
    and display that value. Since a memoview allows both text and data/variable values it is displaying what you told it to display.
    if you want to have sums of values use an intermediate variable for display and write code in either the band's or the memoview's obp event to gather the sum in that variable.
    or use () braces ie (<dataset."field1"> + <dataset."field2">)
    i suggest you read the user manual for working inside the report and the programmers manual as working from delphi.
  • HedleyHedley Peru
    edited 4:44AM
    gordk wrote: »
    read about the displaying expressions with the help of the text object, in the creating reports section of the use manual.
    when you work in a memoview [] tells the engine to calc the value contained inside the braces
    and display that value. Since a memoview allows both text and data/variable values it is displaying what you told it to display.
    if you want to have sums of values use an intermediate variable for display and write code in either the band's or the memoview's obp event to gather the sum in that variable.
    or use () braces ie (<dataset."field1"> + <dataset."field2">)
    i suggest you read the user manual for working inside the report and the programmers manual as working from delphi.

    dear gordk :

    thanks for your guide

    i try with (<alum1m."AS1">+<alum1m."AS2"> ) and don't work... why ? i dont know.. i will check another time, but now dont have time to check

    i use a variable with IIF(<alum1m."AS1"> = 'NS',1,0)+IIF(<alum1m."AS2"> = 'NS',1,0) and it works....

    thanks

    Hedley
  • gordkgordk St.Catherines On. Canada.
    edited 4:44AM
    if using in a memoview add the []
    [(<dataset."field1"> + <dataset."field2">)]
  • HedleyHedley Peru
    edited 4:44AM
    gordk wrote: »
    if using in a memoview add the []
    [(<dataset."field1"> + <dataset."field2">)]

    i try [IIF(<alum1m."AS1"> = 'NS',1,0)+IIF(<alum1m."AS2"> = 'NS',1,0)] but in that moment dont work....

    i do again and it work... perhaps i do something wrong in that moment...

    sorry.. and thanks...

    Hedley
  • gordkgordk St.Catherines On. Canada.
    edited 4:44AM
    no you changed your code from what you previously had.
    previous was [iif(blabla)] + [iif(blabla)]
    you now have [iif(blabla) + iif(blabla)] which is correct
  • HedleyHedley Peru
    edited 4:44AM
    gordk wrote: »
    no you changed your code from what you previously had.
    previous was [iif(blabla)] + [iif(blabla)]
    you now have [iif(blabla) + iif(blabla)] which is correct

    Dear gordk :

    you are rigth... i missed the extra ] [ in the last expression...

    thanks

    Hedley

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.