need help with memo expression

edited May 2011 in FastReport 4.0
hi,
need to display a value from two database filed inside a memo like that:

IIF(<frds."f1"> <> 'N', <frds."f4">, '')] x [IIF(<frds."f1"> <> 'N', <frds."f5">, '')]

is there a way to merge it in one IIF I also did not want to display the 'x' unless IIF results for true

- I tried to find reference for IIF but I did not find. and all Delphi documentation is outdated from 2008 and 2009 !!

thanks

Comments

  • edited 2:36PM
    I see your need for complex expressions becomes bigger and bigger [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I suggest that you should use FR script inside OnBeforePrint event for the band or the MemoView. You can make ANY calculations in a FR script and then finally assign the result to a variable like in example below:[/img]
    var
         MyVariable: string;
           
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
      MyVariable := assign_here_whatever_you_need;                                                                                          
    end;
    

    and set content of your MemoView to [MyVariable].

    Mick
  • edited 2:36PM
    I grow up every day [img]style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> Thanks I know that way but I was wondering if the IIF can handle this, for the sake of knowledge.[/img]
  • gordkgordk St.Catherines On. Canada.
    edited 2:36PM
    Isaac just remember any given expreesion within a memo is only allowed one set of square braces [],
    after that you must use standard braces () to enclose other nested functions.
  • edited 2:36PM
    Yes you can make it all with a single IIF [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I tried with a succes like below:[/img]
    SELECT c.*
      FROM  customer c
     where c.state is not null
       and custno < 2000                                       
     order by c.company
    
    and MemoView content:

    [IIF(<ADOQuery1."State">='HI', IntToStr(<ADOQuery1."CustNo">) + ' x ' + IntToStr(<ADOQuery1."CustNo">), <ADOQuery1."CustNo">)]

    See result in attached file.

    Mick
  • edited 2:36PM
    Many Thanks for all the help this is what I need

    Thanks Mick.pl for being around

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.