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 8:23PM
    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 8:23PM
    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 8:23PM
    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 8:23PM
    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 8:23PM
    Many Thanks for all the help this is what I need

    Thanks Mick.pl for being around

Leave a Comment