Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Memo cannot Suppress Repeated Values

edited May 2007 in General
Using Delphi 7 and 10.06 Enterprise

In my report I am using a variable to populate a memo. I'm using a memo
because it will stretch when required. I am using a variable because the
memo is populated with a name that is constructed from several fields
(Surname, First name, Title etc). The problem I am having is that I don't
want duplicate names shown. Other controls have a "SuppressRepeatedValues"
property but the standard memo does not. Any suggestions on how I can check
for duplicate names and not display the data ?

Ian

Comments

  • edited May 2007
    Hi Ian,

    You will need to check the memo text manually to see if there is a duplicate
    entry. I would suggest storing the memo text once it has been populated and
    comparing it to the next memo before the next detail band prints.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    I've tried what you suggested but am having a slight problem. I've created a
    global variable (called sTemp) to store the users name. In the variable
    control I compare the name I have created from all the fields with sTemp. If
    they match I send an empty string to the memo control. If they don't match I
    send the name and update sTemp with this new value.

    This works fine apart from the very first name on the first page. The name
    is always blank as if the name I create matches sTemp (which it can't as I
    load sTemp with text that isn't a possible match in the GlobalOnCreate
    event). Any ideas ?



  • edited May 2007
    Hi Ian,

    Are you coding this in RAP? If so, I would recommend first getting this
    working in Delphi so you can determine which events you should use etc. and
    so you can trace your event code to see exactly what is happening. Then try
    moving that code to RAP.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2007
    I am doing all my coding in RAP. I have fixed the problem by not only
    checking to see if the name matches the previous stored version but also if
    the band count = 0. Here is code that creates the name and populates the
    memo control.


    procedure vbNameOnCalc(var Value: Variant);
    var
    FirstName : string ;
    Surname : string ;
    Title : string ;
    EmpNum : string ;
    Result : string ;

    begin
    FirstName := Access['First Name'];
    Surname := Access['Surname'];
    Title := Access['Title'] ;
    EmpNum := Access['Emp Number'] ;

    if (Title = '') and (FirstName = '') and (EmpNum = '') then
    begin
    Result := Surname ;
    end
    else if (Title = '') and (FirstName = '') then
    begin
    Result := Surname + ' (' + EmpNum + ')' ;
    end
    else if (Title = '') and (EmpNum = '') then
    begin
    Result := Surname + ' ' + FirstName ;
    end
    else if Title = '' then
    begin
    Result := Surname + ' ' + FirstName + ' (' + EmpNum + ')' ;
    end
    else if (FirstName = '') and (EmpNum = '') then
    begin
    Result := Surname + ' ' + Title ;
    end
    else if FirstName = '' then
    begin
    Result := Surname + ' ' + Title + ' (' + EmpNum + ')' ;
    end
    else if EmpNum = '' then
    begin
    Result := Surname + ' ' + FirstName + ' ' + Title ;
    end
    else
    begin
    Result := Surname + ' ' + FirstName + ' ' + Title + ' (' + EmpNum +
    ')' ;
    end ;

    if (Detail.Count <> 0) and (Result = sTempName) then
    begin
    Result := '' ;
    end
    else
    begin
    sTempName := Result ;
    end ;

    memoName.Text := Result ;
    end ;



This discussion has been closed.