Insert, append, overwrite or delete the value of a Memo field with the content of another memo field.
In the new Memo class the essence is to be able to manipulate and "play" with memo fields in any way you like. We have MemoCopy() that works the same way as MemoMemoCopy() but it simply appends/copies a normal DataEase field rather than a memo.
MemoMemoCopy() allow you to move the information in Memofields around and merge them together.
MEMO FIELD
This is the destination Memo field which will be either overwritten, appended, inserted or delelted.
MEMO FIELD2
This is the value that will be appended or inserted into MEMO FIELD.
NUMERIC VALUE
This is the switch that will decide wich action the MemoMemoCopy() function will take:
0=Append value to memo field.
1=Overwrite memo field with new value.
2=Delete/Blank Content of memo field.
3=Insert value at beginning of memo field.
4=Append value to Memo with CR in front (Start on new line)
5=Insert value at beginning of memo with CR after.
Example 1 - Append
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,0)
Result: This is Memo1This is Memo2
Example 2 - Overwrite
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,1)
Result: This is Memo2
Example 3 - Delete
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,2)
Result: <blank>
Example 4 - Insert
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,3)
Result: This is Memo2This is Memo1
Example 5
This example is from the Send Advanced E-Mail example in the Default Template.
if (MemoLength(Emailbody)>0,MemoCopy(MailBodyCoded,"<div>",1)+MemoMemoCopy(MailBodyCoded,Emailbody,0)+MemoCopy(MailBodyCoded,"</div>",0)+MemoReplace(MailBodyCoded,chr(13),"<br>")+MemoWriteToFile(LinkedStyles ,MailFile,1)+MemoWriteToFile(MailBodyCoded,MailFile,0)+MemoWriteToFile(MySiignature,MailFile,0),0)
This formula builds the Email body.
If Email body is not ampty >
MemoCopy a start HTML <div>
MemoMemoCopy The content of Emailbody to the new MailbodyEncoded
MemoCopy a end HTML </div>
Then we parse through the New MailbodyEncoded and replace all Text carriage returns with proper HTML <br> line break tags.
Then we write the style header to the filepath stored in virtual field Mailfile with overwrite.
Then we append the Encoded Mail body to the Mailfile.
Then we append the Email signature to the mailfile.
And this is the result. Properly formatted properly styled and with Email signature...Voila!
This function copies, appends, or inserts a Memo into another Memo. This function will make it possible to build an advanced Memo field from many other Memo field.
Same as MemoCopy, just that it copies Memo fields into Memo instead of normal DataEase field types.
Syntax
MemoMemoCopy(MemoTo,MemoFrom,Switch)
? where MemoTo is the result Memo, MemoFrom is the memo to be copied, inserted or appended.
Switch: 0=Append, 1=Overwrite, 2=Insert at beginning.
Returns
An empty string so the function can be used as part of any derrivation without interfering with the derivation result.
Example
Memo1 contains "DataEase" and Memo2 contains "Is great"
MemoMemoCopy(Memo1,Memo2,0)
? will reuslt with the Memo1 containing : DataEase is great
MemoMemoCopy(Memo1,Memo2,1)
? will result with Memo1 containing> is great
MemoMemoCopy(Memo1,Memo2,2)
? will result with Memo1 containing: is great DataEase
Notice that "MyName" has no space, because the trailing space in "My " was truncated. Whereas the words "Name is" are correctly spaced, because the string " is" had a leading space.
The Jointext function is retained, and can still be used.
Complimentary Functions
MemoCopy() - same function but copies, inserts or overwrite a Memo with a normal DataEase field or constant.
WriteToFile() - Function that will perform the same functionality, but write to a file instead of a Memo.
Chr() - Function that returns the ASCII character for a number, you will need this to insert " or NewLine into a Memo.
MemoWriteToFile() - Same as WriteToFile() but writes, inserts or appends a memo to a file.
MemoReadFromFile() - Reads a file into a memo.
Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 07/05/15 at 12:10:59
Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 08/05/15 at 20:10:43
Product: Dataease [{8}]FIVE. Written by DataEase 29/09/11 at 12:32:32