Defining a Memo (from table) as a calculated field

I am using Quick Report and need to create a calculated field from a memo. The only way I have found you can do this is to create a string field of say 1000 chars and then use:-
     Table1CalcString1000.AsString := '';            // Calculated note field of length 1000
     Table1CalcString1000.AsString := Table1NotesMemo1.AsString + Table1NotesMemo2.AsString;
The problem with this method is that the memo may grow beyond the 1000 characters and then the string is truncated. Can you suggest a better method?
Eric KayAsked:
Who is Participating?
 
ygolanConnect With a Mentor Commented:
Eric,

Define a calculated BLOB field instead of Memo. You can use Assign to copy the values between the memo and the blob.  Here is some sample code :

Table1CalcBlob.Assign(Table1NotesMemo1.AsString + Table1NotesMemo2.AsString);

... And in Delphi 2 and Delphi 3 strings can be of any length up to 2GB.
0
 
javiertbCommented:
As far as I know, Strings can only hold up to 255 chars and if you want to have more chars stored you have to use an AnsiString variable, but there's not an AnsiString TField. Were you able to put 1000 chars in a TStringField? Maybe you should use a calculated memo field to write your data in.
0
 
Eric KayAuthor Commented:
Setting it to 1000 works OK, The problem is that you CAN'T create a calculated memo field. Try it.
0
 
javiertbCommented:
Yes, you CAN. I simply used the Fields Editor, created new calculated Memo field (with a size of 65535 or less) and that's it. Couldn't you do it?

0
 
Eric KayAuthor Commented:
You must have had the table closed, try doing the same thing with the table active. It enables you to do it with the table inactive, but as soon as you try to activate the table an error is generated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.