Simplicty and flexibility!


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

[@EOF@]...

Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien.&nbsp;le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 è poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40

[@EOF@]...

Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about MemoCopy


dg3_HelpView