put the ttsbegin after
 if (qryRunAddress.prompt())  and then close the
transaction by ttscommit accordingly.

cheers,
Girish
        
--- Danny Gaethofs <[EMAIL PROTECTED]> wrote:


---------------------------------

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.


Yahoo! Groups Sponsor  ADVERTISEMENT
 

---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/Axapta-Knowledge-Village/
 
   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
 
   Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.




        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/kGEolB/TM
--------------------------------------------------------------------~-> 

Sharing the knowledge on Axapta. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Axapta-Knowledge-Village/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to