Mssql Stored Proc Executing Multiple Times On Tag Creations Follow

0
Avatar
Legacy Poster

I am using a stored proc to generate RFID tag info on the fly using a stored proc.  The problem with this appears that the custom SQL gets executed 4 times per label.  1 time when Print Station selects the label containing the stored proc. then 3 more times as the label prints.  It appears based on the tag that prints that the label is the 2nd one printed.  But I've had it query 3 or 5 times a few times as well. 

 

Is there any way to stop Bartender from running the stored proc multiple times?  Since my stored proc does an insert, I am ending up with multiple records in the table when it really should only run once.  I suspect it is running the query to see the field names or to do some validation.

 

Below is my stored proc.

 

BEGIN

SET NOCOUNT ON;

  create table #Temp (Tag varchar(24), Taglabel varchar(8))

  update A Set A.maxcount = a.maxcount+1 from [dbo].[tagtype] A where a.id = @tagid insert into #Temp

SELECT cast(datepart(YY,getdate()) as varchar )
       + right('0' + cast(datepart(MM,getdate()) as varchar),2)
       + right('0' + cast(datepart(DD,getdate()) as varchar),2)
       + right('0' + cast(datepart(HH,getdate()) as varchar),2)
       + right('0' + cast(datepart(mi,getdate()) as varchar),2)
       + RIGHT('000' + @tagid,4)
       + right('00000000' + cast(maxcount as varchar),8) as Tag
       , maxcount as TagLabel
       from dbo.tagtype where tagtype.id =@tagid

insert into Taglist (Tag) select tag from #Temp

select * from #Temp

END

2 comments

0
Avatar
Legacy Poster
Comment actions Permalink

As a workaround, I am attempting to see if the tag already exists in the BtSubStringValues table, but whenever I attempt to pull data from it it causes an OLE 0x80004005 Error which is a generic "OOPS" error.  Seems like that table it locked or something is preventing me from reading it on tag creation.  Is there some other way to query the table to see if the tag already exists?

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

Are you trying to access a table from the BarTender System Database? If yes, you can only do this by making use of the BarTender System Database SDK, so automating BarTender externally.

 

Alternatively, if you would like to know the value of a certain data source or BarTender object on the label, you can access this value via VBScripting. Take a look in BarTender's Help at the "Visual Basic Scripting > Scripting Objects > Object Reference" topic (FormatObject and Objectobject).

Please sign in to leave a comment.