I don't know of a way to do this in ER, but to do it in a C function is quite simple.
This is how you can copy a media objects data from one place to another. . .
Create a DSTR for the function that has the COPY FROM and COPY TO key for your media object.
In the C code, call the API that retrieves the media object(use the COPY FROM key), now just call the API that writes the new media object (use the COPY TO key).
Something like this. . . .:
************************************
// declarations
DSGT55005 dsGT55005; //The FROM KEY
DSGT55006 dsGT55006; //the TO KEY
LPSTR pGenericText = (LPSTR)NULL;
// move the key fields
memcpy(&dsGT55005.mnAddressNumber, &lpDS->blah blah blah
memcpy(&dsGT55005.mnDocumentOrderInvoiceE, &lpDS->blah blah blah
memcpy(&dsGT55005.szOrderType, lpDS->blah blah blah
memcpy(&dsGT55005.szCompanyKeyOrderNo, lpDS->blah blah blah
// get the FROM KEY media object using this API:
pGenericText = GetGenericText("GT55005",(ID)0, &dsGT55005, TRUE);
if(pGenericText==NULL)
return(ER_ERROR);
// your FROM KEY media object is now 'in' pGenericText
// move the key fields for your TO KEY
memset ((void *)(&dsKey55006), (int)('\0'), sizeof(dsKey55006));
memcpy(&dsGT55006.mnAddressNumber, &lpDS->blah blah blah
memcpy(&dsGT55006.mnDocumentOrderInvoiceE, &lpDS->blah blah blah
memcpy(&dsGT55006.szOrderType, lpDS->blah blah blah
memcpy(&dsGT55006.szCompanyKeyOrderNo, lpDS->blah blah blah
// insert to your new media object with this API:
// This does inserts too, not just updates.
idJDEDBReturn = ModifyGenericTextName ((LPSTR)"GT55006",(LPVOID)&dsKey55006,(LPSTR)pGenericText);
************************************
Tada! That's almost all the code there is. The rest is left as an exercise for the student
Darren Ricciardi - OneWorld Whipping Boy
Looking for work WEST of DENVER