Simplicty and flexibility!


Function::Memo

MemoDecodePair
MemoDecodePair(MEMO FIELD,TEXT VALUE)
MemoDecodePair(MyMemo,"Customer")
MemoDecodePair(MyMemoCoded,LOOKUP MyCodes Code)

Syntax of Coded Pair:
[@codename:value@]
[@Customer:4ThePeople Ltd@]
[@MyMessage:This is a message to all DataEase users@]


To extract a coded value from a value pair inside a Memo field.

DataEase have always been very good at storing structured data and retrieving it. What it has not been so good at is to store and exploit unstructured data or dynamically generated data.

In DataEase for DOS you had a limited ability with OUTPUT in DQL to create your own Exports and you could decode the import in a DQL but it was always a little awkward and laborious. In DFW this venue was closed of as well.

DataEase is all about making advanced stuff simple and changing memo from being something dead and dour into something living has been a fun challenge.

When you Pair MemoDecodePair() with MemoCopy(), MemoWriteToFile() and MemoReadFromFile() as a start you have a very exciting tool for importing, exporting, adding and extracting data from a unstructured format.

Have a look at the example and use your creativity and you will amaze yourself.

Parameters


MEMO FIELD


The Memo field which contains the Value Pair.

TEXT VALUE


The coded name for the value pair.

Returns/Result


The matching value for the coded name in TEXT VALUE.

Examples


Example 1

We have a Memo named MyMemo that contains a long and boring text;

...and then we figured out that the companies tax return had been issued on the wrong paper. But [@Customer:4ThePeople Ltd is a great company@] nobody at the Inland Revenue had recognised this....

MemoDecodePair(MyMemo,"Customer")

Returns: 4ThePeople Ltd is a great company.

Example 2

Simple and stupid example. We hope that you will be able to use this for something more "useful"

Here we have to editable fields where one enter Customer Name and Address. 

We also have a Editable Virtual Memo field (just for fun) where you can type any text.

When you hit the button Encode Memo we append the Code Pairs to the text.

MemoCopy( CodedMemo ,concat("[@Customer:",Customer Name ,"@][@Address:",Address ,"@]"),0)

MemoDecodePair will only search through a Memo field till it find the pair in question so if there is more than one matches it will simply find the first one. Try this out by changing the values of Customer Name and Address and hit Encode Memo again...as many times as you like ;-)

In our example we simple decode the Memo immediately in tow virtual fields:

MemoDecodePair( CodedMemo ,"Customer") & MemoDecodePair( CodedMemo ,"Address")

Examples need to be stupid, it is the law, but please use this for something more creative and useful.

Reference

This might be "greek" for the ones of you that hasn't followed us through the new MemoClass/WebField class project, but for those that have, this will be the last clue to the riddle.

Over the last couple of months, you have been able to see Memo transferred from something to be avoided, to one of the most important features in "modern" DataEase.

We now use it for saving Web Pages, Building reports, building exports etc etc, and last but not least Importing Data with MemoReadFromFile...

MemoReadFromFile is brilliant to read info back into a memo field so it can be displayed with WebField (Advanced Webfield) further edited with HTMLEdit or simply printed with PrintMemo(), but one thing have been missing...

What if there is information in there that I want to extract?

Obviously there is functions like MemoFind, that you can use to find a occurrence, but what about extracting information?

This has been a little headache, because how do you limit or tell DataEase what to extract?

We have stole a little from DG3, and we have stole a little from how things are transmitted on the web, and we have come up with MemoDecodePair()

This function will need the data to have been encoded in a certain format as a pair.
[@variablename:value@] ex. [@customername:DataEase International Ltd@]

MemoDecodePair(MemoToScan,"customername") will then return DataEase International Ltd.

The return value of MemoDecodePair is string(256).

So is this useful to me?

We have simply shown a simple extraction, but this can of course be manipulated programatically using all the other DataEase function, so you can unwind a lot of information in a DQL for instance by adding a sequence number to the variablename, and saving a record for each turn of the wheel...

Use your imagination...we create the functionality, it is your job to exploit it and break it ;-)

See Also


MemoCopy
WriteToFile
MemoMemoCopy
MemoReadFromFile
MemoWriteToFile
MemoReplace

On the forum about MemoDecodePair

On the blog about MemoDecodePair

New Function in 8 - MemoDecodePair() - Function to return the value from a encoded pair in Memo (Ver. 8.0.0.11.40)

This might be "greek" for the ones of you that hasn't followed us through the new MemoClass/WebField class project, but for those that have, this will be the last clue to the riddle. Over the last couple of months, you have been able to see Memo transfe...

Product: Dataease [{8}]FIVE. Written by DataEase 04/10/12 at 08:39:54


dg3_HelpView