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
;
if ID = 1 then
enter a record in MemoFldIssueTestTbl
dummy := MemoCopy (MemoFld , MainTbl FirstName , 1) ;
dummy := MemoCopy (MemoFld , MainTbl LastName , 4) .
End
if ID = 2 then
enter a record in MemoFldIssueTestTbl
MemoFld := MainTbl ID ;
dummy := MemoCopy (MemoFld , MainTbl FirstName , 4) ;
dummy := MemoCopy (MemoFld , MainTbl LastName , 4) .
End
End
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 news is that in DE9 this is no longer necessary as Memo has been properly incorporated as it should always have been into PRISM so all string functions will now handle and return text up to 4GB.
We have also create a memo variable class in DQL so you can do.
Define myMemo memo .
And then you can do.
myMemo := concat(Memo,text,memo,text etc…).
However as long as you use 8.5 you have to follow the rules for Memo.
Memo is a separate structure to string so you need a virtual memo to manipulate in your DQL.
When you do Enter a Record you dont get this structure (you do when you modify because you then already have the dataset in memory).
Enter a record is a pure create function where you dont have the Multiview to manipulate as you have in Modify Record or List Records.
So in your case you can choose a global solution by creating an outerloop or you can add a virtual memo to the source table to use for manipulation.
Ive done both in your sample.
define "dummy" text .
for MainTbl
;
if ID = 1 then
dummy := MemoCopy (DummyMemo , FirstName , 1) .
dummy := MemoCopy (DummyMemo , LastName , 4) .
enter a record in MemoFldIssueTestTbl
MemoFld := MainTbl DummyMemo .
End
if ID = 2 then
dummy := MemoCopy (DummyMemo , FirstName , 1) .
dummy := MemoCopy (DummyMemo , LastName , 4) .
enter a record in MemoFldIssueTestTbl
MemoFld := MainTbl DummyMemo .
End
End
Here Ive added dummymemo to MainTbla nd simpl use it as temporary storage before I allocated it to MemoFld in new table in your enter a record.
You see that I do the manipulation outside the enter a record.
As you with this method has to add a memo field to each source table (you can use any memo that is in the source table or in any previous part of the DQL structure as you only exploit the memory allocation and as long as you dont save the changes back it has no detrimental effect).
So what I normally do is to create a dummytable with one SAVED record and use as an outer loop for any DQL that do Memo manipulation. It is cleaner and more logical.
define "dummy" text .
For DummyTable ;
for MainTbl
if ID = 1 then
dummy := MemoCopy (DummyTable DummyMemo , FirstName , 1) .
dummy := MemoCopy (DummyTable DummyMemo , LastName , 4) .
enter a record in MemoFldIssueTestTbl
MemoFld := DummyTable DummyMemo .
End
if ID = 2 then
dummy := MemoCopy (DummyTable DummyMemo , FirstName , 1) .
dummy := MemoCopy (DummyTable DummyMemo , LastName , 4) .
enter a record in MemoFldIssueTestTbl
MemoFld := DummyTable DummyMemo .
End
End
here you see that the DQL start with looping the Dummytable which only have one saved record (if you have 2 or more you will do this 2 or more times so not adviceable… ;-)