Thanks for your post and suggested solution but it's my understanding (backed up by the code below) that the Insert Text system function simply appends the text to the Media Object control.
In the code below I am clearing the szAttachmentText_ADDTEXT variable before fetching the text from the attachment and subsequently inserting into the Media Object control. The result is the work order and routing attachment text being appended to the end of the media object control when selecting a new grid row rather than clearing the control and only displaying text associated with the newly selected row:
--------------------
=======================================================================
FORM: Work Order Workbench [FIND BROWSE] (W560006A)
=======================================================================
CONTROL: GRID Grid
EVENT: Row is Entered
-----------------------------------------------------------------------
0079 //
0080 // get the work order attachment text and (if found) insert into
0081 // TextAttachments control
0082 VA evt_szAttachmentText_ADDTEXT = ""
0083 Media Object Structures(GT4801, <Default Media Object>, <Get Text>, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT, GC OrderNumber, GC OrTy, GC OrdSuf, FC RecordType_EV01)
0084 If VA evt_szAttachmentText_ADDTEXT is not equal to <Blank> And VA evt_szAttachmentText_ADDTEXT is not equal to <Null>
0085 Insert Text(FC TextAttachments, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT)
0086 End If
0087 //
0088 // loop through the routing and append operation attachment text to the
0089 // TextAttachments control
0090 F3112.Select
GC Order Number = TK Document (Order No, Invoice, etc.)
0091 F3112.Fetch Next
VA evt_szF3112WorkCenter_MCU <- TK Business Unit
VA evt_mnF3112OperationSeq_OPSQ <- TK Sequence Number - Operations
VA evt_szF3112OperationType_OPSC <- TK Type Operation Code
0092 While SV File_IO_Status is equal to CO SUCCESS
0093 VA evt_szAttachmentText_ADDTEXT = ""
0094 Media Object Structures(GT3112A, <Default Media Object>, <Get Text>, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT, VA evt_szF3112WorkCenter_MCU, VA evt_mnF3112OperationSeq_OPSQ, ...)
0095 If VA evt_szAttachmentText_ADDTEXT is not equal to <Blank> And VA evt_szAttachmentText_ADDTEXT is not equal to <Null>
0096 Insert Text(FC TextAttachments, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT)
0097 End If
0098 //
0099 F3112.Fetch Next
VA evt_szF3112WorkCenter_MCU <- TK Business Unit
VA evt_mnF3112OperationSeq_OPSQ <- TK Sequence Number - Operations
VA evt_szF3112OperationType_OPSC <- TK Type Operation Code
0100 End While
0101 Set Cursor Position(FC TextAttachments, <Default Text Object>, <HOME>)
0102 //
--------------------
I've tried the following:
- setting the TextAttachments control to empty string "" in variable assignment (validation error: Form Control with NO szDict assigned)
- using system function Delete Item (didn't work and I've since read that this deletes media object records from the F00165 table but I'm not saving the media object, just using it to combine text from various attachments to display to the user)
- searching JDEList forums
- searching Oracle Metalink
- using an Edit control instead (this could work but text was appended without carriage return so it was not possible to differentiage between the different attachment text. Haven't worked out how to include a carriage return in the edit control)
Any other ideas?
Thanks,
Randall.