Blank fields

edited 7:49AM in FastReport 4.0
I have 6 database fields in a report.
Address1
Address2
Address3
Town
County
PostCode

If there is no data in address3 I get a blank line in the report. How do I 'Move up' the fields below so I don't see the blank line.

Cheers

SteveW

Comments

  • gpigpi
    edited 7:49AM
    Place each memo on separate child band and hide band when one of fields is empty or usee IIF function in expression
  • edited 7:49AM
    I use to insert all fields in one memo by code in OBP-event:

    procedure Memo1OnBeforePrint(Sender: TfrxComponent);
    begin
    Memo1.Text := '';
    if <MyDb."Address1"> <> '' then
    Memo1.Lines.Add(<MyDb."Address1">);
    if <MyDb."Address2"> <> '' then
    Memo1.Lines.Add(<MyDb."Address2">);
    end;



    Petter

  • gordkgordk St.Catherines On. Canada.
    edited 7:49AM
    Place all fields in one memo
    then write code for the oad event of the memo.

    procedure memonameOnAfterData(Sender: TfrxComponent);
    var i: integer;

    begin
    for i := TfrxMemoView(Sender).Lines.Count - 1 downto 0 do
    begin
    if TfrxMemoView(Sender).Lines.Strings = '' then
    TfrxMemoView(Sender).Memo.Delete(i);
    end;
    end;
  • edited 7:49AM
    I have set the report out with all the fields in one memo but in the IDE when I click on the events tab I cannot see any events (ie the properties tab remains in focus)

    Cheers

    SteveW
    gordk wrote: »
    Place all fields in one memo
    then write code for the oad event of the memo.

    procedure memonameOnAfterData(Sender: TfrxComponent);
    var i: integer;

    begin
    for i := TfrxMemoView(Sender).Lines.Count - 1 downto 0 do
    begin
    if TfrxMemoView(Sender).Lines.Strings = '' then
    TfrxMemoView(Sender).Memo.Delete(i);
    end;
    end;
  • gordkgordk St.Catherines On. Canada.
    edited 7:49AM
    What version and level of fr are you using? Basic level does not allo0w you to code in the report, the code given is in the report script not the ide
  • edited 7:49AM
    I have delphi Xe2 update 4 and the version that comes with that.

    Can you please explain where I place the code.(at idiot level)

    Cheers

    SteveW
    gordk wrote: »
    What version and level of fr are you using? Basic level does not allo0w you to code in the report, the code given is in the report script not the ide
  • gpigpi
    edited 7:49AM
    FR Embarcadero Edition doesn't support scripts like FR Basic
    Try to use IIF function in TfrxMemoView
  • edited 7:49AM
    gpi wrote: »
    FR Embarcadero Edition doesn't support scripts like FR Basic
    Try to use IIF function in TfrxMemoView

    Where do I do that please ? Is there an example I can look at ?

    Cheers

    SteveW
  • gpigpi
    edited 7:49AM
    [IIF(Trim(<Customers."Addr2">) <> '', <Customers."Addr2">+#13#10, '')][Customers."Company"]
  • edited 7:49AM
    gpi wrote: »
    [IIF(Trim(<Customers."Addr2">) <> '', <Customers."Addr2">+#13#10, '')][Customers."Company"]

    Thanks for the code but I do not know where to add the code. Is there an event within the report or is it on an event on the component?

    Cheers

    SteveW
  • edited June 2012
    classic12 wrote: »
    classic12 wrote: »
    [IIF(Trim(<Customers."Addr2">) <> '', <Customers."Addr2">+#13#10, '')][Customers."Company"]

    Thanks for the code but I do not know where to add the code. Is there an event within the report or is it on an event on the component?

    Cheers

    SteveW
    Right-click the component and enter the code instead of only the table.column reference.

    It works fine if you only have one or two column references. However, more than that quickly results in code which is unreadable, error prone and impossible to debug and get right. Even using the facility to build the expression by dropping in functions and column references often creates code which still throws up errors, so much so that I have abandonned using that construct except for the most simple things. It looks to me that there are some internal limitation as to the nesting levels.

    Do yourself a favor, preserve your mental and physical health, and get the standard version with the scripting capability. Working with a script will make many problems almost child's play.

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.