// create to records in temporary table FOR iTemp := 1 TO 2 DO BEGIN Currency.Code := 'Code ' + FORMAT(iTemp); Currency.INSERT; END; // loop trough temporary records IF Currency.FIND('-') THEN BEGIN REPEAT MESSAGE('loop on original temp record: %1',Currency.Code); UNTIL Currency.NEXT = 0; END; // make a copy of the temporary record, Currency2 is temporary too Currency2 := Currency; // loop through copy of temporary record // DOES NOT WORK! IF Currency2.FIND('-') THEN BEGIN REPEAT MESSAGE('loop on copy of temp record: %1',Currency2.Code); UNTIL Currency2.NEXT = 0; END;
Answers
This will not copy your records into Currency2.
You'll need an INSERT...
What do you think?
The find('-') works in Normal tables because the entries exist. When working with temporary tables they don't exist. you need a loop to copy all the records from one variable to the other...
The problem is the following. My code example was just for demonstration purposes. I actually try to pass a record variable to another object (form or report). This is a bit difficult to show in an example, but same problem there. Working with non-temporary vars works just fine, working with temporary vars don't.
Any ideas appreciated
Thomas
Rec.COPY(FromRecord[,ShareTable]) which is available (with the extra parameter) only in version 6...
In prior versions you will need to pass the parameter as a VAR and then loop through the records and add them in your Temporary Global Variable...
I mean 2009... :oops:
If it's not a temp record it points to the actual table. You will see all records for every non-temporary record variable, because they all point to the same table, you are looking at actual physical records in the physical table. The two variables are two different objects in memory, but they point at the same thing.
If you want to fill a temp record in one object and send the whole thing into another, you'll have to pass it by reference (i.e. with the VAR checkbox ticked in the parameter screen). Also make sure that the parameter itself is temporary.
RIS Plus, LLC
MVP - Business Apps
Thanks, this works, the code now loops through the parameter in the remote function (passed by reference). Then another temporary variable of the same type is filled with the values. Maybe not the sleekest way, but with only a few records we need it for its ok.
Thanks also to Daniel for his explanations!
Thomas
RIS Plus, LLC
MVP - Business Apps
Mibuso.com is THE place to get infos like that!!