Simplicty and flexibility!


MemoReplace(MyMemo,"[{custoner}]","DataEase International Ltd")
retval := MemoReplace(MemoToManipulate,"Test","OK") .

Memo and String is

To replace all occurrences of a string in a Memo with another string.

Can be used to populate a template with the content of a table etc.



This is the Memo Column name that is to be manipulated. After the manipulation the value in the Record will have changed.


String to Replace in the Memo. You can ex. use a Tag like [{customername}] and later replace it with a real customer name.


The new value you want to replace the one you searched for.


integer : number of occurrences replaced. 0=Not found.


Example 1. (Found in ExecDQLStore in CRM sample)
DQLNr 301 - Generate Labels Avery1

define temp "Telle" number .

define temp "tRow" number .

define temp "tColumn" number .

define temp "tTemporaryID" text .

define temp "retval" text .

define temp "tMCopy" number .

tMCopy := 1 . -- The switch that tell the MemoMemoCopy to Overwrite or append a page. First page is Overwrite, rest is append.

tColumn := 1 . -- Column number in array

tRow := 1 . -- Row number in array.

for Customers with CustomerNR <= data-entry field1 ; -- Here you set the selection criteria for the labels. Lazy so just use CustomerNr < but you can use anything.

if tColumn > 3 then --end of row x, ka-ching new line. Here you can read the 3 as a variable from the Template system instead if you want to make it generic.

tColumn := 1 .

tRow := tRow+1 .

if tRow>6 then -- this is hardcode because we are lazy, you can of course look this up from your template form together with the template.

tRow := 1 .

Telle:=0 .

tMCopy := 0 . -- now 0 because we want to append another page.



modify records in Temporary with TemporaryID = "Avery1" -- we use a pre-existing page because you can't insert and modify a page in the same DQL. Lazy again.

Dummy := if(telle=0, concat(MemoMemoCopy(Body, any Templates with TemplateID ="TL0002" Body ,tMCopy),"") ,"") ; -- here we insert the first page, and append the successive.

Dummy := MemoReplace(Body ,concat("[{CustomerName",tRow,tColumn,"}]"), Customers CustomerName ) ; -- here we dynamically replace the tags in the matrix

Dummy := MemoReplace(Body ,concat("[{Address",tRow,tColumn,"}]"),Customers Address ) ;

Dummy := MemoReplace(Body ,concat("[{Contact",tRow,tColumn,"}]"),Customers Contact ) ;

Dummy := MemoReplace(Body ,concat("[{Town",tRow,tColumn,"}]"),Customers Town ) ;

Dummy := MemoReplace(Body ,concat("[{PostCode",tRow,tColumn,"}]"),Customers PostCode ) ;

Dummy := MemoReplace(Body ,concat("[{Country",tRow,tColumn,"}]"),Customers Country ) .

tColumn := tColumn + 1 . -- counting up the columns

telle := telle + 1 . -- lazy again, it never need to be more than 1 to make the trigger mechanise safe.


retval := SetLabelText("Status",concat("Generate Labels finished. ",data-entry field1, " labels generated.")) .

retval := SetVar("TempFilter","Avery1")+DocumentOpen("Temporary") .




Memo Function


Replaces all occurences of search in a memo with new value. This is possibly one of the most influetial new functions in DataEase 8. This is the function you will use to replace tags in Memos to create letters, emails, webpages etc.



? where MemoToReplaceIn is the result Memo, Search is the value to be replaced and NewValue is the value that will substitute.


An empty string so the function can be used as part of any derrivation without interfering with the derivation result.


Memo1 contains: "bla bla this is a test etc etc Companyname: [{company}] bla bla bla"
MemoReplace(Memo1,"[{company}]","4ThePeople Limited")

? will reuslt with the Memo1 containing : "bla bla this is a test etc etc Companyname: 4ThePeople Limited bla bla bla"

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.

See Also



On the forum about MemoReplace

Is there any difference in the syntax of the function MemoReplace used in a button or using MemoExecDQL?

Use this text in a button on the form order. This works as it should.SetValue("DQL_Nr" ,"104") + Wait(0.1) + MemoExecDQL( DQL ,"2","","","","") +Wait(1) + MemoReplace(settings,"[{filename}]",GetVar("VarSt...

Product: Dataease [{8}]FIVE. Written by Tor Nerland 12/11/14 at 09:42:53

Re:Is there any difference in the syntax of the function MemoReplace used in a button or using MemoExecDQL?

The syntax on a button and in a DQL is different but only in how you reference the column and when/where.In a form you will always have the PRISM column available but in a DQL it depends on where in the DQL you try to address it.1. Do yo...

Product: Dataease [{8}]FIVE. Written by DataEase 12/11/14 at 10:53:54

On the blog about MemoReplace

New Function in 8 - MemoReplace() - Replace a string in a memo. Wake up, this is important! (Ver.

So what is so important with a simple Replace function?Everything! This is how you can really manipulate your Memo's to behave the way you want them too.It is called Memo Class for a reason, it is in combination they become powerful!...

Product: Dataease [{8}]FIVE. Written by DataEase 05/10/11 at 12:19:30

New function in 8 - MemoMemoReplace() - Replace a tag with the content of a Memo (Ver

This is the&nbsp;complementary&nbsp;function of MemoReplace() which replace a tag in a Memo with the content of a string(255) or any other "normal" prism field/value.The exciting bit about MemoMemoReplace() is that you can replace any tag with...

Product: Dataease [{8}]FIVE. Written by DataEase 08/05/13 at 13:46:40