heres the code nothing different of how this is created as it is similar in other parts of the system. If the records are say 500 then its is very quick! but struggling with such high number of records
FOR FIRST pdm_client FIELDS (pdm_client.client_obj)
WHERE pdm_client.organisation_obj = pdOrganisationObj
NO-LOCK:
FOR EACH pdm_matter
WHERE pdm_matter.client_obj = pdm_client.client_obj
NO-LOCK:
CREATE ttConflictMatter.
ASSIGN ttConflictMatter.cCode = pdm_matter.matter_code
ttConflictMatter.cName = pdm_matter.matter_name
ttConflictMatter.cDescription = pdm_matter.matter_long_description
ttConflictMatter.lChargeable = pdm_matter.matter_chargeable
ttConflictMatter.cRelationship = "Client":U
ttConflictMatter.dMatterObj = pdm_matter.matter_obj
ttConflictMatter.dMatterPartyObj = ?
ttConflictMatter.dOwningOrganisationObj = pdOrganisationObj
ttConflictMatter.dOwningAddressUsageObj = pdAddressUsageObj.
IF plExtraDetails THEN
DO:
ASSIGN ttConflictMatter.tOpenDate = pdm_matter.matter_open_date
ttConflictMatter.cStatus = (IF pdm_matter.matter_status = {&pdmmaMatterStatusOpen} THEN
"Open":U
ELSE
IF pdm_matter.matter_status = {&pdmmaMatterStatusOnHold} THEN
"On Hold":U
ELSE
IF pdm_matter.matter_status = {&pdmmaMatterStatusClosed} THEN
"Closed":U
ELSE
"Archived":U).
RUN extraDetails IN TARGET-PROCEDURE (pdm_matter.branch_obj,
pdm_matter.fee_earner_obj,
pdm_matter.partner_obj,
pdm_matter.department_obj,
pdm_matter.work_type_obj,
OUTPUT ttConflictMatter.cBranchName,
OUTPUT ttConflictMatter.cFeeEarnerName,
OUTPUT ttConflictMatter.cPartnerName,
OUTPUT ttConflictMatter.cDepartmentName,
OUTPUT ttConflictMatter.cWorkTypeName).
RELEASE ttConflictMatter.
END. /* plExtraDetails */
END. /* FOR EACH pdm_matter */
END. /* FOR FIRST pdm_client */