Memo cannot Suppress Repeated Values
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
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
This discussion has been closed.
Comments
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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 ?
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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 ;