The DataGrid - Displaying Related Data


Click your browser's 'Back' button to return to the previous page.

The DataGrids shows data related to the main form on the page, displaying each record on one line in the grid.  The main form information is called the "parent" record, and each item in the DataGrid is called a "child" record.

 

Overview
If the DataGrid is displayed in a Tab Control, the data in each is 'child' data which is related to the record selected in the Navigator, typically called the 'parent' record.

An example of parent/child data is a parent record that holds Company information, and the child records which store information about every person or Contact, in each company. There is always a one-to-many relationship with parent/child records; one parent with one or more child records.

If the DataGrid is alone on the page, it's a full view of all of the data in the table. The Appointments Worksheet in the Appointments Calendar Department is an example of this.

The Toolbar
The toolbar above the form has features for working with each record and is the same on every form. The buttons are:

New - Opens for the form for the child record; click 'Save' to save the new record or 'Cancel' to cancel it. Click the 'Help' button on the dialog's toolbar for help on entering data.

Edit - Opens the selected record in the child form; you can also double-click on a row in the Datagrid to open it for editing.

Copy - Clicking this creates a copy of the current record. After the copy is created, you can edit it to give it a unique key value.

Delete - Click this button to delete the current record; you'll be given the opportunity to cancel the delete action. You can also right-click to delete all of the records displayed in the Datagrid. Again you'll be prompted to cancel the deletions.

NOTE: What Deleting A Record Really Does... When you click the 'Delete' button the record is only marked for deletion, which removes it from the active list of records in the Datagrid. This gives users the opportunity to 'Undelete' something if they find the record is needed. To see all deleted records, change the drop-down list in the center of the Datagrid toolbar to 'Deleted'. When you double-click to edit one of the deleted records, you will see a 'Deleted' checkbox next to the 'Active' checkbox. To undelete a record, uncheck the 'Deleted' checkbox and save it. To really erase the record from the database, click the 'Delete' button while viewing deleted records. The data is then completely erased from the database and cannot be recovered.

Print - This opens the print menu which may or may not have these sections:
Print... - Displays a list of options for printing the current record only. These are defined in the Report Designer.
Reports - Displays a list of summary reports from multiple records. These are defined in the Report Designer.
Labels - May display a list of label printing options (from Label Designer), or simply open the Label Setup dialog where users can choose options for printing labels.
Charts - Displays list of chart printing options, which are defined in the Chart Designer.

 

Click here to view print option selections that you may need to make when printing.

Attachments - The Attachment dialog lets you add file attachments to each record. Click the 'Help' button on the Attachments toolbar for more information.

Utilities
The utilities menu has several options for managing data:

View All Records
This option displays all of the child records for all parent records in the database in a Worksheet (just like the Worksheet button on the Navigator displays the parent records). This is helpful if you need to make changes across all records in the database.

View By <parent value>
This option displays all of the child records for all parent records with the same common value. This is helpful if you only need to change data across a similar group of parent records.

View Displayed Records Only
This option displays the current Datagrid's records in the Worksheet.

NOTE: Please click the 'Help' button on the Worksheet toolbar for how to search and edit records when they're displayed in the DataGrid worksheet.

Import - This option is available only for users who have System Administrator security access. In systems where Security is not used, all users have System Administrator access; otherwise you must specifically be setup in Security in that role. This option lets you choose an external data source (Excel spreadsheet, Access database or Tabbed-Text file) and then match the fields from it into the fields on the page form. This is one way to get data from another system moved into your current database without keying each record.

Export - This allows users to export or save data to another format (Excel spreadsheet, Access database, or tabbed-text file). When exporting data, select the target file type from the file dialog's drop-down list, then enter a name for the exported file. If you choose to export to an existing Access database, you'll be prompted with these options:

1) Replace all existing data with export data
2) Add to existing data, even if it creates duplicates
3) Update any duplicates and add other records as new ones

You must choose one of the options by clicking on it, or you can cancel the export by clicking 'Cancel' on that dialog.

NOTE: When exporting data, only the records displayed in the DataGrid are exported.

Reload Data - Typically the data you see in the Datagrid is loaded when the page opens and then remains cached (stored) on the users computer without reloading it from the database. When multiple users are connected to a database, however, like on a company network, the only way to see other users' changes is to close the page, then reopen it. Clicking the 'Reload Data' option does the same thing without closing the page. Any changes made by other users will then be seen in the Datagrid.

Refresh All Formulas - This action virtually edits and saves EVERY RECORD in the table, which recalculates all of the formulas in each record. Please use this with caution if you are working in a database with Security enforced, as it will update each record to YOUR login name and ID.

Move Selected Records - Sometimes you need to move one or more records to another parent record. Of course you could manually enter each record under the other parent record, then delete the original ones, but using the 'Move Selected Records' utility is much easier! Choose to move a single record by clicking on it to select it, or you can move multiple records by holding down your Ctrl (Control) key to select more than one.

Choose this option from the menu, then a list of parent records will be presented. Choose the target parent record from the list, click 'OK' and the selected child records will be moved.

Copy Selected Records - This works the same way as 'Move Selected Records' except it makes a copy of the selected data and copies it to the selected Parent record. The original data you selected is still with the original Parent record.

Search - This is on the Company page only.
Sometimes you will have the name of a person, but won't know which Company he/she is associated with. You could manually click through all of the Company records and look for the name in the Contacts datagrid, but that's doing it the hard way!

Click the "Search" button to display all contacts in Last Name, First Name - Company ID order, then just start typing the name of the person you're looking for (the text will appear at the top of the list. For example, if you are looking for someone named "Jack", type "JACK" and the list will go to the first item with Jack in the text. Hit "Enter" to go to the next time that matches.

When you find the item you want, click "OK" and the company record will be displayed on the page and the Contact record will be highlighted in the datagrid.

Current/Active/Deleted List
Just as the Navigator lets you see deleted records by clicking a button, the Datagrid lets you see all deleted child records by choosing the 'Deleted' option from the drop-down list. To view records that are marked 'Active' (filtering out the unchecked records), choose the 'Active' option. The 'Current' option shows all non-deleted records, Active or not.

Word Wrap
Fields such as memo fields or some text fields may have a lot of data in them and you cannot see all of the data even if you stretch the column headers as wide as you can. To view the data on multiple lines, click the 'Word Wrap' button to wrap the text and change the height of the rows to show all of the data. NOTE: viewing lots of data with Word Wrap enabled can slow the refresh on the Datagrid, so if you don't need to use it, simply click it again to turn it off and limit each record to a single row height.

Count
This is the number of child records currently displayed in the Datagrid.

The DataGrid Formatting Menu
NOTE:
All formatting changes you make apply to the current Datagrid only; you'll need to set column widths, re-order columns and format column text alignments and row colors in each individual Datagrid in this application.

Right-click on the DataGrid to open the formatting menu with these options:

Save Column Order/Widths
You can reorder the columns on the Datagrid by dragging any column to a different position. You can also drag column widths to have them better fit the data. When you have rearranged the Datagrid to the way you want it, click this option to save your changes.

Reset Column Order
This option will set the column order back to its default and any saved changes will be gone.

Column Text Alignment
The Datagrid aligns data in each column based on the type of data: Text is left-aligned, numbers are right-aligned. You can change each of the column alignments by clicking on the column, then opening this menu and choosing the alignment. To clear custom alignments, click the 'Clear' option.

Column Statistics
Use this option to get some quick information about the data in a column. If the column is a number column, this will display the sum, average, maximum and minimum, count and total values of the data. Date columns display the minimum date, maximum date, average date and count. Text columns display the count only. The results are copied to the Windows clipboard so you can paste it into another application using Ctrl+V.

Hide Column
Use this option to hide the current column; this only hides the column on the DataGrid and will be applied again when you open the page.

Unhide Column
If you have hidden one or more columns, this option will be visible and will have a sublist of the column names. Choose one to 'unhide' it again.

Format Row Colors
This option lets you display the entire Datagrid with alternating row colors. Click the 'Alternate Background Color' to choose the background color of the cells; click the 'Alternate Text Color' to choose the text color in those alternate rows. You can clear the choices by clicking the 'Clear' option.

Select All Rows
This will select all of the rows in the DataGrid. Use this option if you want to select all child records before using the 'Move Selected Records' or 'Copy Selected Records' utility.

Notification Format
Sometimes you want to be able to flag a value in a line item so you don't miss is. For example, if you have items in an Order or Invoice that should always be looked at and/or edited, you would want to be reminded when the record is created. In a sales system, standard options may be entered in the Product Catalog as "Please Select", where there are multiple options to choose from and the user needs to decide when creating the Order or Invoice.

The Notification Format feature does just that; lets you specify the text to look for, then colors all of the text in that column as long as that text is in at least one of the rows in that column.

Right-click on the column in the DataGrid (NOT the column header) to open the popup menu and click on 'Notification Format'. You'll be prompted to enter the text to look for, then the color dialog will prompt you to choose a color for the text.

 

Click your browser's 'Back' button to return to the previous page.

 


Crow River Tech, LLC. Copyright© 2010. All Rights Reserved

Microsoft Windows XP/Vista/7, SQL Server 2005, Access, Outlook and Excel are trademarks of Microsoft Corporation. 

Any other product names are trademarks of their respective companies.