Easy to Create, Easy to Change - Easy to use!

Function::Memo

MemoCopy

MemoCopy(MemoField,Field,Switch) MemoCopy(MemoField,"Constant",Switch) MemoCopy(MemoField,concat("This is derrived from current username: ",current username),switch) MemoCopy(MemoField,Field,0) - Append to Memo. MemoCopy(MemoField,Field,1) - Overwrite/Rep

Insert or append a standard DataEase field or string value into a Memo Field.
Memo is a new field class in DataEase 8 with it's own functions to manipulate and bridge the gap between traditional DataEase functionality and Memo. Memo will not work with standard functions like Jointext(), Concat() etc. because they can only manipulate 246 bytes at a time. 

MemoCopy() is designed to insert/append any traditional DataEase value into any Memo field. You can insert it at the beginning, overwrite the Memo, delete/blank the current value or simply append it at the end.

It is designed to be used for building Memo content dynamically or to manipulate Memo fields by adding content. It can be used both for normal text adding (export etc.) or it can be used for adding coding like html/CSS etc.

This function can be called from a Button (Action), a derivation (i.e field derivation or validation) or be used as a part of a DQL query to populate a Memo list, export creation, web page build etc.

Parameters


MemoField 

the field that will be manipulated by this function. It need to be of Memo Class. If one try to use MemoCopy() on a field that is not of memo class, nothing will happen.

Field

You can use any standard derivation for this parameter. ex. Concat("My names is: ", current user name) or Lookup Customer Customername or spelldate(current date).
Value to be appended or inserted into MemoField. This value is of type String(256). You can append any DataEase field to a Memo field with MemoCopy and it will be represented correctly as the function will translate them to string. 
If you want to append a constant you need to use "" i.e. "My personal message" or "12/12/12" if it is a date. or "£1,234.45" if it is a currency number. 

Switch

This parameter control the behaviour of MemoCopy(). 

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.

Returns/Result


This function returns only a blank string. All new Manipulation functions will return a blank string so they can be used as part of any derivation.

Examples


You will find an extensive example on how to get best use of this function in our Tutorial Database which is shipped with DataEase 8.

For this example we have Memo field MyMemo that contains the text:

"And the winner is"


Example 1


MemoCopy(MyMemo,"Peter Griffin",0)

Result: And the winner is Peter Griffin.


Example 2


MemoCopy(MyMemo,"Peter Griffin",1)

Result: Peter Griffin

Example 3


MemoCopy(MyMemo,"Peter Griffin",2)

Result: <Nothing>

Example 4


MemoCopy(MyMemo,"Peter Griffin",0)

Result: Peter Griffin And the winner is.

Example 5


This example will be a little more practical. Let say we want to insert a new sentence at the beginning i.e a heading. We will combine MemoCopy() with another new function chr() which will allow you to append any ASCII value as well like CR or ".

MemoCopy(MyMemo,concat("This is the results of the Norwegian Jury!",chr(13),chr(10)),3)+MemoCopy(MyMemo,"Peter Griffin",0)

Result: 
The Result of the Norwegian Jury!
And the winner is Peter Griffin.

We see here that we get a carriage return after the new heading. This can be very useful when you are going to build documents etc in Memo fields or diretctly in Text fields with WriteToFile() etc.

Example 6


This is a real example from our Avanced Email Example in the Default template in 8. Here we combine MemoCopy with the External Function GetFileName the new function GetCurrent() and the result is quite exhilarating.

MemoCopy(Attachments,concat(GetFileName("","",GetCurrent("MyDocuments")),","),0)

What hapens here is:
1. When we click on the Button Attach File, we get a Select File dialogue that points directly on YOUR My Documents catalogue. You can then browse till you find your attachment (You can of course add a further structure behind My Documents etc). 


2. You select the file you want to attach and click Open.
3. The file name gets appended to the Attachment Field in the Email.

Suddenly the normal limitations of one value in a field etc. is gone. You can attach as many attachments as you please.  This list is later written to a file via a virtual field, and attached via the emailing functionality.

Reference

MemoCopy

Type

Memo Function

Purpose

Copies, Appends or Inserts a Field or a constant into a Memo field.

This function is part of the Memo manipulation class which bridge the gap between Memo and standard DataEase type fields like Text, Number, Numeric String, Date, Time, Choice etc.

This is a very useful function if you would like to build a document/storage in a Memo field for instance for export, or for presentation in WebField.

 

Syntax
 

 

MemoCopy (MemoToCopyTo,FieldToCopyFrom,Switch)
 

? MemoToCopy to is the memofield you want to insert,append or overwrite.

? FieldToCopyFrom is the field/constant you want to insert,append to the memo
 

? Switch is: 0 = Append, 1= Overwrite, 2=Insert at beginning.

Returns

An empty string so the function can be called as a part of any formula without interfering with content of field.

 

Example

Memofield Body contains: DataEase 8 is great! before we execute function

MemoCopy(Body,"This is a test!",0)

? would result in the content of Body being: DataEase 8 is great! This is a test!
MemoCopy(Body,"This is a test!",1)

? would result in the content of Body being: This is a test!
MemoCopy(Body,"This is a test!",2)

? would result in the content of Body being: This is atest! DataEase 8 is great!

Complimentary Functions


MemoMemoCopy() - same function but copies, inserts or overwrite a Memo with another Memo.
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.

 



 

See Also


WriteToFile MemoMemoCopy MemoReadFromFile MemoWriteToFile MemoReplace

On the forum about MemoCopy

MemoMemoCopy Changed ?

Hallo Dataease Forum !I have a new Special Kind if Problems.If i Use MemoMemoCopy an i want to work with the Switch "0" or with "1" nothing rigth happend.I use RefreshScreen() after this functions.But if i use the Switch "4...

Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 07/05/15 at 12:10:59

Re:MemoMemoCopy Changed ? Has been cleared!

Hallo Dataease Forum,i think this subjekt has been cleared !I found out that the Documentation (PDF File with the Functions help) is not correct !If i compare it with the Documentation at the Blog on this Webpage i can see that no...

Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 08/05/15 at 20:10:43

Re:Re:MemoMemoCopy Changed ? Has been cleared!

Hello!Thanks for this.We are working with a revision of the documentation so hopefully these discrepancies will soon be removed....

Product: Dataease [{8}]FIVE. Written by DataEase 11/05/15 at 12:39:50

DataEase 8.5 - MemoCopy Error

; I am getting a error message, see below. I am pulling my hair. But, cant seem to figure out why;...

Product: Dataease [{8}]FIVE. Written by 05/05/18 at 10:30:39

Problems with MemoCopy()

When you run the DQL ‘zzTestDQL’, (Under) you will see it is only entering the data for ID = 1.It does not matter, same problem when I use the ExecDQL.It looks like ignoring the second IF statement part of the MemoCopy.for MainTbl...

Product: Dataease [{8}]FIVE. Written by 17/10/19 at 12:14:13

Re:Problems with MemoCopy()

Hi Arul. Memo in before 9 is a special case that is awkward to work with (impossible before 8). This is why we had to create all these Memo functions to allow you do manipulate Memos the same way as other fields.The best ne...

Product: Dataease [{8}]FIVE. Written by DataEase 17/10/19 at 12:17:09

MemoCopy ()

Hi all,Using this function how&nbsp;is possible&nbsp;to copy a text field from a form XX to a memo field in another&nbsp; form YY ?For example form XX has a field text and in OML clicked event i'm trying to use the sentence as follows :<...

Product: Dataease [{8}]FIVE. Written by afonso santos 12/08/20 at 02:17:56

Re:MemoCopy ()

Download Sample Dear Afonso. There is several ways to do this but this e...

Product: Dataease [{8}]FIVE. Written by DataEase 14/08/20 at 11:50:33

Re:Re:MemoCopy ()

Thanks for the explanation.I can't download the example..Afonso...

Product: Dataease [{8}]FIVE. Written by afonso santos 16/08/20 at 18:42:22

Re:Re:Re:MemoCopy ()

Hi again.Sorry about that. Something went wrong when we uploaded the sample. It has now been fixed....

Product: Dataease [{8}]FIVE. Written by DataEase 17/08/20 at 13:29:33

On the blog about MemoCopy

New Function in 8 - MemoMemoCopy() - Copy, Insert or Append a Memo to another (Ver. 8.0.0.1005)

This little function is together with MemoReplace() almost the centrepiece of the Memo Class.As you might have already discovered, normal DataEase functions like Jointext, Firstc, MidC or even Concat, doesn't go very far when it comes to Memo f...

Product: Dataease [{8}]FIVE. Written by DataEase 29/09/11 at 12:32:32

New Function in 8 - MemoCopy() - Copies, Appends, or inserts a field into a Memo (Ver. 8.0.0.1004)

Simple little function that allow you to append, insert or copy a "normal" DataEase field into a Memo field.See MemoMemoCopy() for more information.int MemoCopy(MemoToCopyTo,FieldToCopy,switch) Swtitch: 0=Append 1=Overwrite/copy 2=Insert...

Product: Dataease [{8}]FIVE. Written by DataEase 27/09/11 at 12:40:13

Re:New Function in 8 - MemoCopy() - Copies, Appends, or inserts a field into a Memo (Ver. 8.0.0.1004)

Slight error in the spec: 0=Append 1=Owerwrite 2=Delete 3=Insert at beginning. Sorry!...

Product: Dataease [{8}]FIVE. Written by DataEase 15/11/12 at 11:44:21