I am encountering a lot of problems with my DDs. The issue (I think) is that I have quite a number of tables that are relating to the same base tables, and I am transferring data from one table to another.

Ex
gbQuote to gbPolicy
gbQuoteYear to gbPolicyYear

All tables have almost the same structure and are relating to the same base tables

ex gbQuote and gbPolicy both relate to gbClass Table which in turn is related to another table.

When I am copying over the records, the DD's are being cleared and a lot of errors are generated.

I am using this code to transfer the data:

Code:
        Get_Attribute DF_FILE_NUMBER_FIELDS of hQuoteFile to iQuoteFields
        Get_Attribute DF_FILE_NUMBER_FIELDS of hPolicyFile to iPolicyFields
        //
        If (iQuoteFields <> iPolicyFields) Begin
            Error DfErr_Operator 'Cannot create Policy Record'
        End
        //
        Send Clear of hPolicyDD


        //
        If (bOK) Begin  


            Set Field_Changed_Value of hPolicyDD Field gbpolicy.PolicyNo    to sPolNo
            Set field_Changed_Value of hPolicyDD Field gbpolicy.QuoteMainNo to gbQuote.QuoteMainNumber
            
            For iCnt from 4 to iQuoteFields
                Set Field_Changed_Value of hPolicyDD iCnt to (Field_Current_Value (hQuoteDD, iCnt))
            Loop
            //
            Set Field_Changed_Value of hPolicyDD Field gbpolicy.CreatedDate to dDate
            Set field_Changed_Value of hPolicyDD Field gbpolicy.CreatedBy  to WebAppUser.LoginName
            Set Field_Changed_Value of hPolicyDD Field gbpolicy.LastTransactionNo to sTranNo            
            //
            Send Request_Save of hPolicyDD
Is there a way to access the field number for the global file buffer and update the contents of the field accordingly?

Currently using DD:
For iCnt from 4 to iQuoteFields
Set Field_Changed_Value of hPolicyDD iCnt to (Field_Current_Value (hQuoteDD, iCnt))
Loop

Something along the lines of:

For iCnt from 4 to iQuoteFields
Move (Field_Current_Value (hQuoteDD, iCnt)) to gbPolicy.iCnt.value ??
Loop


I was thinking of transferring the data directly thru SQL to resolve this but would prefer to do this within my code.

TIA

Jesmond






Quote Originally Posted by starzen View Post
no problem. if you post more details on your data files and dds we may be able to help some more