Hi there.
I include a rendering of my data at the end of the post. SCROLL WAY DOWN.
I have a novel problem. I must regularly generate indices of various documents exported from a database. These consist of emails and their attachments, as well as other documents mixed in that are not associated with any emails. I refer to emails and their attachments as "families", with the emails "parents" and the attachments "children".
A description of the fields in use:
BEGDOC - the key field, a unique identifier of each record.
ENDDOC - left blank.
BEGATTACH - used to designate families.
ENDATTACH - left blank.
PGCOUNT- left blank.
PARENTID - to be populated by code.
ATTACHID - to be populated by code.
DOCTYPE - identified whether a document is an email with attachments, email without attachments, or an attachment.
For those documents that are emails and attachments, I need to automate the population of two fields in my report, PARENTID and ATTACHID. These are populated with the BEGDOC value. These fields need to be populated as follows:
-PARENTID is populated where DOCTYPE = "Attachment" with the BEGDOC value of its parent email.
-ATTACHID is populated where DOCTYPE = "eMail/eMail with attachment" with all of the BEGDOC values for its children attachments, separated by a semicolon.
Again, parent / children family relationships are designated by the BEGATTACH field.
Any and all suggestions are welcome!
Thanks!
<table>
<tr>
<td>BEGDOC</td>
<td>ENDDOC</td>
<td>BEGATTACH</td>
<td>ENDATTACH</td>
<td>PGCOUNT</td>
<td>PARENTID</td>
<td>ATTACHID</td>
<td>DOCTYPE</td>
</tr>
<tr>
<td>RKT-GA-915650</td>
<td></td>
<td>RKT-GA-915650</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>eMail/eMail without attachment</td>
</tr>
<tr>
<td>RKT-GA-915670</td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915670; RKT-GA-915671</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915671</td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915672</td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915673</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915673</td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915676</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915692; RKT-GA-915755; RKT-GA-915758; RKT-GA-915762</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915692</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915755</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915758</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915762</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915770</td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915789</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915789</td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td></td>
</tr>
</table>
I include a rendering of my data at the end of the post. SCROLL WAY DOWN.
I have a novel problem. I must regularly generate indices of various documents exported from a database. These consist of emails and their attachments, as well as other documents mixed in that are not associated with any emails. I refer to emails and their attachments as "families", with the emails "parents" and the attachments "children".
A description of the fields in use:
BEGDOC - the key field, a unique identifier of each record.
ENDDOC - left blank.
BEGATTACH - used to designate families.
ENDATTACH - left blank.
PGCOUNT- left blank.
PARENTID - to be populated by code.
ATTACHID - to be populated by code.
DOCTYPE - identified whether a document is an email with attachments, email without attachments, or an attachment.
For those documents that are emails and attachments, I need to automate the population of two fields in my report, PARENTID and ATTACHID. These are populated with the BEGDOC value. These fields need to be populated as follows:
-PARENTID is populated where DOCTYPE = "Attachment" with the BEGDOC value of its parent email.
-ATTACHID is populated where DOCTYPE = "eMail/eMail with attachment" with all of the BEGDOC values for its children attachments, separated by a semicolon.
Again, parent / children family relationships are designated by the BEGATTACH field.
Any and all suggestions are welcome!
Thanks!
<table>
<tr>
<td>BEGDOC</td>
<td>ENDDOC</td>
<td>BEGATTACH</td>
<td>ENDATTACH</td>
<td>PGCOUNT</td>
<td>PARENTID</td>
<td>ATTACHID</td>
<td>DOCTYPE</td>
</tr>
<tr>
<td>RKT-GA-915650</td>
<td></td>
<td>RKT-GA-915650</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>eMail/eMail without attachment</td>
</tr>
<tr>
<td>RKT-GA-915670</td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915670; RKT-GA-915671</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915671</td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td></td>
<td>RKT-GA-915670</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915672</td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915673</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915673</td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td></td>
<td>RKT-GA-915672</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915676</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915692; RKT-GA-915755; RKT-GA-915758; RKT-GA-915762</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915692</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915755</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915758</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915762</td>
<td></td>
<td>RKT-GA-915755</td>
<td></td>
<td></td>
<td>RKT-GA-915676</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td>RKT-GA-915770</td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td></td>
<td></td>
<td>RKT-GA-915789</td>
<td>eMail/eMail with attachment</td>
</tr>
<tr>
<td>RKT-GA-915789</td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td></td>
<td>RKT-GA-915770</td>
<td></td>
<td>Attachment</td>
</tr>
<tr>
<td></td>
</tr>
</table>