Aveva Sqldatagrid Symbol User Guide
Aveva Sqldatagrid Symbol User Guide
© 2020 AVEVA Group plc and its subsidiaries. All rights reserved.
No part of this documentation shall be reproduced, stored in a retrieval system, or transmitted by any
means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written
permission of AVEVA. No liability is assumed with respect to the use of the information contained herein.
Although precaution has been taken in the preparation of this documentation, AVEVA assumes no
responsibility for errors or omissions. The information in this documentation is subject to change without
notice and does not represent a commitment on the part of AVEVA. The software described in this
documentation is furnished under a license agreement. This software may be used or copied only in
accordance with the terms of such license agreement.
ArchestrA, Aquis, Avantis, Citect, DYNSIM, eDNA, EYESIM, InBatch, InduSoft, InStep, IntelaTrac,
InTouch, OASyS, PIPEPHASE, PRiSM, PRO/II, PROVISION, ROMeo, SIM4ME, SimCentral, SimSci,
Skelta, SmartGlance, Spiral Software, Termis, WindowMaker, WindowViewer, and Wonderware are
trademarks of AVEVA and/or its subsidiaries. An extensive listing of AVEVA trademarks can be found at:
https://sw.aveva.com/legal. All other brands may be trademarks of their respective owners.
Publication date: Wednesday, October 7, 2020
Contact Information
AVEVA Group plc
High Cross
Madingley Road
Cambridge
CB3 0HB. UK
https://sw.aveva.com/
For information on how to contact sales and customer training, see https://sw.aveva.com/contact.
For information on how to contact technical support, see https://sw.aveva.com/support.
2
AVEVA™ SQLDataGrid Symbol User Guide
Contents
Chapter 1 Welcome ................................................................................................... 5
Documentation Conventions ...............................................................................................................5
Technical Support ...............................................................................................................................5
Chapter 2 Configuring the SQLDataGrid Symbol....................................................... 7
About Configuring the SQLDataGrid Symbol .....................................................................................7
Securely Accessing the SQL Data Grid ..............................................................................................8
Using the SQLDataGrid Symbol .........................................................................................................9
Configuring Authentication Modes ................................................................................................9
Windows Authentication .......................................................................................................10
SQL Server ...........................................................................................................................10
Configuring the Database Connection ........................................................................................10
Configuring SQLDataGrid Symbol Custom Properties ...............................................................10
Using Scripts with the SQLDataGrid .................................................................................................12
Associating Grid Control Actions to InTouch Scripts and Animations ........................................12
Accessing Data from a Selected Row in the SQLDataGrid ........................................................12
Chapter 3 Working with the SQLDataGrid in Run Time ........................................... 15
About Working with the SQLDataGrid in Run Time ..........................................................................15
Viewing Data .....................................................................................................................................15
Populating the Table, View or Query List ...................................................................................15
Solving Hide and Show Window Issues .....................................................................................16
Moving Columns .........................................................................................................................16
Grouping Columns ......................................................................................................................16
Viewing Aggregate Values..........................................................................................................19
Using Progressive Column Filtering ...........................................................................................20
Discarding Changes ..........................................................................................................................22
Viewing Errors ...................................................................................................................................22
Writing Changes to the Database .....................................................................................................22
Views and Updates .....................................................................................................................23
Database Connection Management .................................................................................................24
Connection Sharing and Pooling ................................................................................................24
Appendix A Custom Properties for the SQLDataGrid Symbol.................................. 27
3
AVEVA™ SQLDataGrid Symbol User Guide
C HAPTER 1
Welcome
This guide describes configuring and using the SQLDataGrid symbol. The SQLDataGrid is delivered as
an Industrial graphic, and can be used as an InTouch graphic.
You can view this document online or you can print it, in part or whole, by using the print feature in Adobe
Acrobat Reader.
This guide assumes you know how to use Microsoft Windows, including navigating menus, moving from
application to application, and moving objects on the screen. If you need help with these tasks, see the
Microsoft online help.
This guide also assumes that you know how to use Microsoft SQL Server. For help with SQL Server, see
the Microsoft online help.
In some areas of the Application Server, you can also right-click to open a menu. The items listed on this
menu change, depending on where you are in the product. All items listed on this menu are available as
items on the main menus.
Documentation Conventions
This documentation uses the following conventions:
Technical Support
AVEVA Technical Support offers a variety of support options to answer any questions on Wonderware
products and their implementation.
Before you contact Technical Support, refer to the relevant section(s) in this documentation for a
possible solution to the problem. If you need to contact technical support for help, have the following
information ready:
The type and version of the operating system you are using.
Details of how to recreate the problem.
The exact wording of the error messages you saw.
Any relevant output listing from the Log Viewer or any other diagnostic applications.
Details of what you did to try to solve the problem(s) and your results.
If known, the Technical Support case number assigned to your problem, if this is an ongoing
problem.
5
AVEVA™ SQLDataGrid Symbol User Guide
C HAPTER 2
Configuring the SQLDataGrid Symbol
About Configuring the SQLDataGrid Symbol
The SQLDataGrid is a symbol that enables you to interact with data stored in SQL databases. You can
use the SQLDataGrid symbol in an InTouch application that you create in a published or managed mode.
The following graphic shows the main components associated with the SQLDataGrid.
You can perform the following activities with the SQLDataGrid symbol:
Insert or modify data in selected database tables and views.
Delete rows from a database table (select the row and press the Delete key).
Select data from existing tables and views.
Run a custom SQL query.
This section provides the following information:
The minimum configuration required by the SQLDataGrid symbol to retrieve data from a SQL
database.
The set of custom properties that must be configured to authenticate users and connect to the
database.
A list of the custom properties that define the parameters associated with a specific database and
query to be retrieved.
7
AVEVA™ SQLDataGrid Symbol User Guide Configuring the SQLDataGrid Symbol
8
Configuring the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
For detailed information on working with symbols, see the ArchestrA and InTouch Integration Guide.
9
AVEVA™ SQLDataGrid Symbol User Guide Configuring the SQLDataGrid Symbol
Windows Authentication
If you use Windows as a value for the Authentication_dg custom property and do not designate
custom properties for a domain, user, or password, the SQLDataGrid symbol uses the credentials of the
user who is currently logged on to the node running InTouch.
If you select Windows as a value for the Authentication_dg custom property and designate custom
properties for a domain, user, and password, the SQLDataGrid symbol uses the specified Windows
domain name, user name, and password to connect to the SQL Server database.
SQL Server
This authentication mode uses the specified SQL Server user name and password to connect to the SQL
Server database.
If you are using a non-default port for the SQL Server database, see the SQLData Object help file for
configuration information.
To configure the database connection
1. In the Custom Properties pane, select ConfiguredServer_dg.
2. In the Default Value box, type the network name of the computer hosting the database.
3. In the Custom Properties pane, select ConfiguredDatabase_dg.
4. In the Default Value box, type the name of the target database.
5. In the Custom Properties pane, select SQLQuery_dg.
6. In the Default Value box, type the name of the target table, view or query.
To populate the SQLDataGrid, click Runtime, and then click Retrieve.
10
Configuring the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
ConfiguredPassword_dg
ConfiguredUser_dg
Database Connectivity Designate database connectivity functions
AutoRefresh_dg
AutoRefreshDuration_dg
CmdCancel_dg
CmdRefresh_dg
CmdRetrieve_dg
CmdTestConnection_dg
CmdWrite_dg
ComboBoxListString_dg
ConfiguredDatabase_dg
ConfiguredReadOnly_dg
ConfiguredServer_dg
RowCount_dg
RowLimit_dg
SelectedRowNumber_dg
SQLQuery_dg
SQLQueryCurrent_dg
SQLQueryPassThrough_dg
SQLQueryPending_dg
Diagnostic Perform diagnostic functions
CmdLogDiagnostics_dg
CmdResetDiagnostics_dg
ErrorPanelDisable_dg
StatusDesc_dg
StatusError_dg
StatusIsError_dg
Appearance Modify the appearance of the run-time SQLDataGrid that
contains data from the database
ButtonPanelHide_dg
CmdPageFirst_dg
CmdPageLast_dg
CmdPageNext_dg
CmdPagePrev_dg
ColumnAggregateEnable_dg
11
AVEVA™ SQLDataGrid Symbol User Guide Configuring the SQLDataGrid Symbol
ColumnFiltering_dg
ColumnGroupingEnable_dg
ComboBoxPanelHide_dg
FontBold_dg
FontName_dg
FontSize_dg
SupportThemes_dg
SuppressAuthenticationWarning
WriteButtonHide_dg
12
Configuring the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
The following script example shows how to retrieve data from a selected row. Notice that the
SelectedRowData property is available in the SQLDataGrid client control and not in the SQLDataGrid
symbol.
dim rd1 as System.Data.DataRow;
rd1 = SQLDataGridUserCtrl1.SelectedRowData;
if(rd1 <> null) then
InTouch:Text9 = rd1.ItemArray[4].ToString();
'This assigns the 4th column value for the selected row, to the InTouch "Text9"
tag.
endif;
13
AVEVA™ SQLDataGrid Symbol User Guide
C HAPTER 3
Working with the SQLDataGrid in Run Time
About Working with the SQLDataGrid in Run Time
During run time, you can select the database table, view, or query that will populate the SQLDataGrid
symbol and change the appearance of the data.
You can use the run-time application to perform the following tasks:
Move columns
Group columns
Aggregate column values
Filter columns
Sort columns
If you have the appropriate permissions, you can also make the following changes to the database:
Change the order of columns in an existing row.
Insert a row into a table.
Update a row in a table.
Delete a row from a table.
Note: You cannot update or delete a row in a table unless that table has a primary key defined. You can
add new rows to a table without a primary key as long as that is the only action you are performing on the
table.
Viewing Data
You can use the run-time version of the SQLDataGrid symbol to view data in the following formats:
Data from a specific table
Data from a specific view
Data that is retrieved by a SQL query
You can resize the column width of any table, view, or query result.
To view specific data from a SQL query
1. In the Table, View or Query box, type a SQL query.
2. Click Retrieve. The appropriate dataset appears.
15
AVEVA™ SQLDataGrid Symbol User Guide Working with the SQLDataGrid in Run Time
Moving Columns
You can rearrange the order of the columns to meet your viewing needs.
To move columns
1. Click the heading of the column that you want to move.
2. Holding your mouse key down, drag the column heading to another position within the table.
Grouping Columns
The group-by function lets you sort data at more specific levels. This example shows a view that groups
customer names and their business addresses.
Note: The ColumnGroupingEnable_dg custom property must be True before you can use this function.
16
Working with the SQLDataGrid in Run Time AVEVA™ SQLDataGrid Symbol User Guide
17
AVEVA™ SQLDataGrid Symbol User Guide Working with the SQLDataGrid in Run Time
4. To view the data groups, press Enter to expand any of the StateProvince items.
5. To see a more specific sorting of the data, drag another column heading to the upper sorting area.
6. If you want to sort the data at an even finer level, you can repeat steps 3 and 4 and drag another
column heading to the sort area.
7. If you want to remove one of the column headings from the sorting area, drag it down to the data
area.
18
Working with the SQLDataGrid in Run Time AVEVA™ SQLDataGrid Symbol User Guide
Note: Before you can use this function, the ColumnAggregateEnable_dg custom property must be True.
You can perform the following functions on column data. Not all operations may be available for a column
because of the data type.
Average: Calculates the average number of items in the column.
Count: Lists the number of rows in the column.
Maximum: Lists the highest number in the column.
Minimum: Lists the lowest number in the column.
Sum: Adds the numbers in each row and provides a total.
To view aggregate values
1. Click Aggregate. The summation sign (S) appears at the head of each column.
2. Click the summation sign at the top of the OrderQty column. The Select Summaries dialog box
appears.
3. Select Average and click OK. The value appears just below the Grand Summaries row. You can
re-size the column width to view the entire number This following figure shows the average value for
OrderQty.
19
AVEVA™ SQLDataGrid Symbol User Guide Working with the SQLDataGrid in Run Time
6. Move your cursor over the field below the LastName column heading. A list arrow appears.
7. You can filter the values by any of the following actions:
20
Working with the SQLDataGrid in Run Time AVEVA™ SQLDataGrid Symbol User Guide
o Click the list arrow and type the first letter of the value If you type additional letters, your sort is
more precise.
o Click the list arrow and select an item from the list.
o If you select the (Custom) item from the list, you can further refine your search in the Custom
dialog box. This example shows a search for two different area codes.
21
AVEVA™ SQLDataGrid Symbol User Guide Working with the SQLDataGrid in Run Time
8. To perform a different search, clear your search criteria by clicking the cancel icon at the left of the
filtering row.
Discarding Changes
If you need to discard the changes made to grid values, click Retrieve. This action reloads the table
values from the database and discards any changes. You can also initiate the action by using a script
that sets the CmdRetrieve_dg property to True.
Viewing Errors
You can manually display or close the Status panel in the lower part of the grid display area. The status
panel can also automatically appear when an error occurs. However, after the panel appears, it remains
on view.
If a command object is successful, the message "Success" appears in the Status panel. If the panel is
closed, "Success" messages do not appear for successful command objects.
To close the panel, click the double-arrow icon at the right of the panel. To open the panel on demand,
right-click and select Show Status.
Note: The error panel display does not change the overall area occupied by the grid symbol.
22
Working with the SQLDataGrid in Run Time AVEVA™ SQLDataGrid Symbol User Guide
Tip: After you modify cells in the grid and write them back to the database, you should also verify that
the data is correctly written. In certain cases, such as a database table with an automatically
incrementing primary key or interdependent cells, the grid does not show the true contents of the
database table after you write back to it. Also, no error message is shown. It is recommended that you
execute a retrieve or auto refresh command after writing to the database to make sure it is showing the
current data.
23
AVEVA™ SQLDataGrid Symbol User Guide Working with the SQLDataGrid in Run Time
7. Click an area outside the edit area. The Write button becomes enabled.
8. Click Write.
9. To verify the change, click Retrieve.
24
Working with the SQLDataGrid in Run Time AVEVA™ SQLDataGrid Symbol User Guide
Note: Connection sharing and connection pooling require that the same security mode and user
credentials be used for all SQLDataGrid symbols within the InTouchView application that shares the
connection or the pool.
25
AVEVA™ SQLDataGrid Symbol User Guide
A PPENDIX A
Custom Properties for the SQLDataGrid
Symbol
The following table lists all available Custom Properties. Data types are shown in the Custom Properties
panel and are not included in this table.
27
AVEVA™ SQLDataGrid Symbol User Guide Custom Properties for the SQLDataGrid Symbol
28
Custom Properties for the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
ComboBoxListReadOnly_dg If False, you can make changes to the edit box above
the combo list box.
Writable at Run Time: Yes
Default: False
29
AVEVA™ SQLDataGrid Symbol User Guide Custom Properties for the SQLDataGrid Symbol
ConfiguredUser_dg The SQL Server user name if security type is SQL. This
property is optional when security type is Windows.
Writable at Run Time: Yes
Default: Blank
30
Custom Properties for the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
ContextMenuEnable_dg When True and you right-click the grid, the context
menu appears.
When False and you right-click the grid, the context
menu does not appear.
Writable at Run Time: Yes
Default: True
31
AVEVA™ SQLDataGrid Symbol User Guide Custom Properties for the SQLDataGrid Symbol
SQLQueryCurrent_dg Specifies the SQL command that was run to show the
current data in the SQLDataGrid.
Writable at Run Time: No
Default: Blank
32
Custom Properties for the SQLDataGrid Symbol AVEVA™ SQLDataGrid Symbol User Guide
33
AVEVA™ SQLDataGrid Symbol User Guide Custom Properties for the SQLDataGrid Symbol
34