Chapter 8 - Pulse SQL Development
Chapter 8 - Pulse SQL Development
Chapter 8 - Pulse SQL Development
1
AFCON Software and Electronics Ltd
Enable the identity property to the Inx column (for auto incrementing
number)
2
AFCON Software and Electronics Ltd
Type getdate() in the Stamp Column Default Value field (it will add the
current timestamp to the Stamp column on every row insert)
In this exercise, you will create an OLEDB datasheet tag connected to the
tblProduction table and display the table data in a Pulse datasheet instrument.
Finally, you will connect the index column to Pulse addresses in order Select a
column for update or delete.
3
AFCON Software and Electronics Ltd
5 In the Data Link Properties Provider tab, choose Microsoft OLE DB Provider
for SQL Server.
4
AFCON Software and Electronics Ltd
6 Switch to the connection tab and edit the sql server connection properties.
then click Test Connection and note if the connection succeeded. Click OK.
5
AFCON Software and Electronics Ltd
10 Click the data tab to execute and check the query. Click OK.
6
AFCON Software and Electronics Ltd
11 In the Datasheet Manager, click Next, select Read And Write access rights
and name the tag tblProduction.
7
AFCON Software and Electronics Ltd
In this exercise, you will add a Pulse Datasheet instrument to the Production
display, which will retrieve data from the OLEDB database during runtime.
1. From the Insert ribbon, insert a Pulse Datasheet instrument to the display.
3. In the Item field, enter the ProdDB datasheet item using the Item Manager.
8
AFCON Software and Electronics Ltd
Step 4: create an alias and a datasheet tag to store the row index
1. Create an Alias
Token = Temp_Index
2 From the first page of the Datasheet Manager, click Next. Then, choose to
add/edit an INI tag and click Next again.
9
AFCON Software and Electronics Ltd
3 Enter the path and name of the alias INI data source file and choose the
Temp_data Alias.
4 Select Read And Write access rights and name the tag Temp_Index.
10
AFCON Software and Electronics Ltd
11
AFCON Software and Electronics Ltd
When you click a row during runtime, Pulse transfers the table row index data
to the alias file and later you can use it for the row update and delete
Quaries.
2. Click OK.
4. Switch to runtime and observe the table data. You can also modify the
data and click the save button save to update the table.
5. You can type in the upper row in order to filter the data
12
AFCON Software and Electronics Ltd
Exercise 2: create an insert SQL query, to log the part count , machine id
and time stamp.
Step 1: create 2 datasheet tags that hold the machine ID and Parts
count.
2. From the first page of the Datasheet Manager, click Next. Then, choose to
add/edit an INI tag and click Next again.
13
AFCON Software and Electronics Ltd
3. Enter the path and name of the alias INI data source file and choose the
Machine_ID Alias.
4. Select Read And Write access rights and name the tag Machine_ID.
14
AFCON Software and Electronics Ltd
Step 2 - Create an Insert OLEDB Datasheet Tag to insert data into the
tblProduction MS SQL SERVER table.
5. In the Data Link Properties Provider tab, choose Microsoft OLE DB Provider
for SQL Server.
6 Switch to the connection tab and edit the sql server connection properties.
then click Test Connection and note if the connection succeeded. Click OK.
15
AFCON Software and Electronics Ltd
7. In the SQL Query page, type the Query. And use the aliases as parameters.
16
AFCON Software and Electronics Ltd
17
AFCON Software and Electronics Ltd
Step 3 - Create Button on the display that runs the Insert Query.
Clicking the button will set the machine id and the current part counts
into the machine_id and machine_counter datasheet tag.
(Those tags are the insert query parameters) and run the insert query.
18
AFCON Software and Electronics Ltd
Exercise 3: create an Update SQL query, the user will click a row type
the new value and click the update button.
3. Create an Aliases
Token = New_Value
8. From the first page of the Datasheet Manager, click Next. Then, choose to
add/edit an INI tag and click Next again.
19
AFCON Software and Electronics Ltd
9. Enter the path and name of the alias INI data source file and choose the
New_Value Alias.
20
AFCON Software and Electronics Ltd
10. Select Read And Write access rights and name the tag New_Value.
12. Create Machine_counter datasheet tag . Repeat steps 1-5 for the
Machine_Counter Alias.
21
AFCON Software and Electronics Ltd
5. In the Data Link Properties Provider tab, choose Microsoft OLE DB Provider
for SQL Server.
6. Switch to the connection tab and edit the sql server connection properties.
then click Test Connection and note if the connection succeeded. Click OK.
22
AFCON Software and Electronics Ltd
8. In the SQL Query page, type the Query. And use the aliases as parameters.
23
AFCON Software and Electronics Ltd
24
AFCON Software and Electronics Ltd
25
AFCON Software and Electronics Ltd
Step 3 - Create Button on the display that runs the update Query.
26
AFCON Software and Electronics Ltd
Exercise 4: create a Delete SQL query, that deletes the selected row ,
the user will click a row and click the delete button.
27
AFCON Software and Electronics Ltd
6. Switch to the connection tab and edit the sql server connection properties.
then click Test Connection and note if the connection succeeded. Click
OK.
8. In the SQL Query page, type the Query. And use the aliases as
parameters.
28
AFCON Software and Electronics Ltd
29
AFCON Software and Electronics Ltd
Step 2 - Create Button on the display that runs the update Query.
30