Pages

Custom Search

Copying Rowsets

What I want is to copy the like-name fields between &rsExample and &rsExampleAudit (the fields EMPLID and NAME).

The following code will NOT work:
&rsExample.CopyTo(&rsExampleAudit)

Why? Because &rsExample consists of a record named EXAMPLE, but &rsExampleAudit consists of a record named AUDIT_EXAMPLE. Because the two rowsets do not have the same underlying record name, the copy does absolutely nothing.

In this scenario, we need to specify a record list, so it knows the source and target record names. This how I need to write this code to make it work:
&rsExample.CopyTo(&rsExampleAudit, Record.EXAMPLE, Record.AUDIT_EXAMPLE)

Generically the syntax is:
&rsSource.CopyTo(&rsTarget, Record.SOURCE_RECNAME, Record.TARGET_RECNAME)