You can’t have UI between tts statements, move your ttsbegin down in the code some after the prompt (UI)

 

Don

 

-----Original Message-----
From: Danny Gaethofs [mailto:[EMAIL PROTECTED]
Sent: Monday, December 06, 2004 8:57 AM
To: [EMAIL PROTECTED]
Subject: [Axapta-Knowledge-Village] unbalanced x++ ttsbegin/ttscommit

 


dear all,

I am writing a job to update some values on a table based on input
from the user.

The user is presented a query input form and can enter a value.
The whole job is intended to enable users to correct the relations
between alternate addresses and custtable.


The job now generates an unbalanced x++ ttsbegin/ttscommit error,
which I am unable to resolve. Is there someone that can help me out.
Hereafter part of the job.

static void UTIL_CreateAddressRelation(Args _args)
{
    Address                 address;
    CustTable   custTable;
    Query                   qryAddress;
    QueryRun                qryRunAddress;
    QueryBuildDataSource    qryBuildDataSource;
    QueryBuildRange         qryBuildRange;
    qryAddress              = new Query();
    qryBuildDataSource  = qryAddress.addDataSource(TableNum
(Address));
    qryBuildRange       = qryBuildDataSource.addRange(FieldNum
(Address, AddrTableId));
    qryBuildRange.value("*");

    qryBuildDataSource.update(true);

    /* begin transaction */
    ttsbegin;
        qryRunAddress   = new QueryRun(qryAddress);

        if (qryRunAddress.prompt()) // here is where the query starts
        {
            while (qryRunAddress.next())
            {
                address =   qryRunAddress.get(TableNum(Address));
                print address.Name;
                print address.AddrRecId;
                print address.AddrTableId;
                print address.AddrTableId == 77;
                pause;

                switch (address.AddrTableId)
                {
                    case 77:
                        {
                            select custTable
                            where custTable.AccountNum == "4002";

                            if (custTable)
                            {
                                print custTable.AccountNum;
                                pause;

                                ttsbegin;
                                address.AddrRecId = custTable.RecId;
                                address.update();
                                ttscommit;
                            }
                        break;
                        }

                    default:
                        print "Default"; pause;

                } // end switch
            } // end while
        } // end if

    /* end transaction */
    ttscommit;

}






Sharing the knowledge on Axapta.





Sharing the knowledge on Axapta.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to