I have a function which is invoked from looping over selected rows in the selection table. The stored proc is invoked & everything works well for the first record in the selection however after the selection table is edited by the stored proc the selection in MapInfo becomes Null. Is there any way to keep the selection alive after the first edit so I can go on & run the stored proc for the next row in the selection? (ps. I know I'm refreshing the tables in the code however this isn't being hit at run time as the code enters an 'else' before this is invoked due to the null selection:
*****************************************************' Create Historical BidBlock'' Add selected Region from mpBidBlocks to mpHistoricalBidBlocks'*****************************************************sub BidBlock(i_blockID as integer)dim SelCount as integerdim SelTableName as stringdim i_lstCountry,i_contractid,i_type,i_stage,i_MIPRINX as integerdim i_RelinqDate as integerdim s_CurrentRelinqComments as stringdim s_RelinqSchComments as stringdim s_CurrentRelinqArea as stringdim res as stringdim returnResult as stringdim returnResultStatus as integerdim process as stringprocess="moveBidBlock"print chr$(12)''' Make sure supporting tables are openif getSelectionInfo(SelCount, SelTableName) then if SelCount > 0 then if SelTableName = vwBidBlocks then 'Have one Contract selected 'move to Relinquishments and update Historical Contracts if isTableOpen(vwHistoricalBidBlocks) then 'tables are open 'does it need save if doesTableNeedSave(vwHistoricalBidBlocks) or doesTableNeedSave(vwBidBlocks) then note "You must save edits before using this function!" exit sub end if 'is it a polygon if ObjectInfo(Selection.obj, OBJ_INFO_TYPE) = OBJ_TYPE_REGION then 'finally - does the user have this country locked if userHasSelectedCountryLocked() then 'everything is ready res = logFile(dataroot+debugfile,"Historical Bid Block BlockId:" +i_BlockID,"INF") ' ' Now we can complete historical bid block move if executeSPReturnResult(process,"declare @out varchar(200),@Return int exec dbo.pr_moveBidBlock @BLOCKID="+i_blockId+", @MI12='MapInfo', @NewMI_PRINX=@Return output, @Message=@out output select @out,@Return",returnResult , returnResultStatus ) then res = logFile(dataroot+debugfile,"Historical BidBlock returnResult:" +returnResult+" "+returnResultstatus,"INF") ' ' Check result is good ' if returnresultstatus >= 0 then 'refresh the tables call RefreshServerTable(vwBidBlocks, false) call RefreshServerTable(vwHistoricalBidBlocks, false) res = logFile(dataroot+debugfile,"finished "+process,"INF") note "Historical BidBlock completed for BlockId:" +i_BlockID else note "Historical BidBlock failed for BlockId:" +i_BlockID+" possible validation error?" end if else note "Error trying to run "+process+", returned error: "+returnresult exit sub end if else note "Sorry you don't have " + Selection.Country + " locked out" end if else note "You must select a BidBlock polygon" end if else note vwHistoricalBidBlocks + " must be open" end if else note "Your selection must be of a BidBlock to perform a historical bidblock" end if else note "You must select one BidBlock object to perform a historical bidblock" end ifelse note "You need to select a BidBlock before you can use this function"end ifend sub
أكثر...
*****************************************************' Create Historical BidBlock'' Add selected Region from mpBidBlocks to mpHistoricalBidBlocks'*****************************************************sub BidBlock(i_blockID as integer)dim SelCount as integerdim SelTableName as stringdim i_lstCountry,i_contractid,i_type,i_stage,i_MIPRINX as integerdim i_RelinqDate as integerdim s_CurrentRelinqComments as stringdim s_RelinqSchComments as stringdim s_CurrentRelinqArea as stringdim res as stringdim returnResult as stringdim returnResultStatus as integerdim process as stringprocess="moveBidBlock"print chr$(12)''' Make sure supporting tables are openif getSelectionInfo(SelCount, SelTableName) then if SelCount > 0 then if SelTableName = vwBidBlocks then 'Have one Contract selected 'move to Relinquishments and update Historical Contracts if isTableOpen(vwHistoricalBidBlocks) then 'tables are open 'does it need save if doesTableNeedSave(vwHistoricalBidBlocks) or doesTableNeedSave(vwBidBlocks) then note "You must save edits before using this function!" exit sub end if 'is it a polygon if ObjectInfo(Selection.obj, OBJ_INFO_TYPE) = OBJ_TYPE_REGION then 'finally - does the user have this country locked if userHasSelectedCountryLocked() then 'everything is ready res = logFile(dataroot+debugfile,"Historical Bid Block BlockId:" +i_BlockID,"INF") ' ' Now we can complete historical bid block move if executeSPReturnResult(process,"declare @out varchar(200),@Return int exec dbo.pr_moveBidBlock @BLOCKID="+i_blockId+", @MI12='MapInfo', @NewMI_PRINX=@Return output, @Message=@out output select @out,@Return",returnResult , returnResultStatus ) then res = logFile(dataroot+debugfile,"Historical BidBlock returnResult:" +returnResult+" "+returnResultstatus,"INF") ' ' Check result is good ' if returnresultstatus >= 0 then 'refresh the tables call RefreshServerTable(vwBidBlocks, false) call RefreshServerTable(vwHistoricalBidBlocks, false) res = logFile(dataroot+debugfile,"finished "+process,"INF") note "Historical BidBlock completed for BlockId:" +i_BlockID else note "Historical BidBlock failed for BlockId:" +i_BlockID+" possible validation error?" end if else note "Error trying to run "+process+", returned error: "+returnresult exit sub end if else note "Sorry you don't have " + Selection.Country + " locked out" end if else note "You must select a BidBlock polygon" end if else note vwHistoricalBidBlocks + " must be open" end if else note "Your selection must be of a BidBlock to perform a historical bidblock" end if else note "You must select one BidBlock object to perform a historical bidblock" end ifelse note "You need to select a BidBlock before you can use this function"end ifend sub
أكثر...