That matches the input parameter (where the column, Is equal to the input variable – Rockwell Automation RSBizWare Administration Guide User Manual

Page 301

Advertising
background image

Application notes for FactoryTalk Transaction Manager Appendix D

-- uninitialized. Intializing it will alter the end value of the
binary string.

IF @loop = 1

BEGIN

SELECT @out_binary =
(SUBSTRING(@binary1,2,1)+SUBSTRING(@binary1,1,1))

END

ELSE

BEGIN

SELECT @out_binary =
(SUBSTRING(@binary1,2,1)+SUBSTRING(@binary1,1,1)) + @out_binary

END

-- Get next row

FETCH NEXT FROM int_cursor

INTO @val1

select @loop = @loop + 1

END --while for fetch

CLOSE int_cursor

DEALLOCATE int_cursor

END—proc

FactoryTalk Transaction Manager can write to a controller a data
block consisting of multiple integers selected from one row of a

table. The stored procedure combines columns of a database table
into a binary string, which is then bound to a FactoryTalk
Transaction Manager data block item.

The stored procedure finds the row in

my_int_table

that matches

the input parameter (where the column

record_row

is equal to the

input variable

@in_number

), and returns the four integers combined

in a varbinary field. In FactoryTalk Transaction Manager, bind the

in_number

to an integer register in the controller such as

n227:0

.

The register can contain values 1 through 10. Then bind the

varbinary field

@out_binary

to a 4-element data block, such as

N7:0,L4

.

NOTE

The stored procedures only accept positive integers from 0 to 32,767.

CREATE TABLE my_int_table (int1 INT,int2 INT,int3 INT,int4
INT,record_row INT IDENTITY)

INSERT INTO my_int_table values (1,2,3,4)

INSERT INTO my_int_table values (21,22,23,24)

Sending data blocks from one
row in a table using Integer
data

Rockwell Automation Publication BZWARE-IN001M-EN-P-June 2014

301

Advertising