Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update conflict
Message
 
 
To
18/11/2010 09:19:26
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01489567
Message ID:
01489573
Views:
48
>I seem to be having a new issue with one of my applications.
>
>An error is being returned, Update Conflict zgetmaxitem line 4 data source inspdata.
>
>inspdata is a table in a database that is part of a form's DE. Shared, not exclusive.
>
>The zgetmaxitem is a procedure I have defined in the form.
>
>as follows;
>
>
>IF !EOF('inspdata') AND !BOF('inspdata')
>	LOCAL lnRecNo
>	lnRecNo=RECNO('inspdata')
>	CALCULATE MAX(inspdata.itemnum) FOR inspdata.jobnum==(inspheader.jobnum) TO lnMaxItem
>	IF lnRecNo>0
>		GO lnRecNo IN 'inspdata'
>	endif	
>	RETURN lnMaxItem
>ELSE
>	RETURN 0
>endif
>
Try
	LOCAL lnRecNo, lcJobNo, lnOldSelect
                    lcJobNo = InspHeader.JobNum
	lnRecNo=RECNO('inspdata')
                    lnOldSelect = select()
                    select InspData
	CALCULATE MAX(ItemNum) FOR jobnum==m.lcJobNo TO lnMaxItem

                     lnMaxItem = NVL(m.lnMaxItem,0)
                     if lnRecNo > 0
                         goto m.lnRecNo in InspData
                    endif
                     select (m.lnOldSelect)

In other words, try using a variable for JobNo from related table.

In addition, can you show the UPDATE command? What is the purpose of the procedure - if it's to generate next ItemNum per JobNum, this procedure may not guarantee 100% uniqueness.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform