Computer Learning Zone CLZ Access Excel Word Windows

If you need to invoke your academic pedigree or job title for people to believe what you say, then you need a better argument.

-Neil deGrasse Tyson
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List

   
 
HTA

Advanced - Tabular Data Control

Tabular Data Control

Using the Tabular Data Control.

Say you have an export of data from another program and you wish to display it in a certain way you can use the Tabular Data Control which gives you some extra functionality.

Say we have a file called Data.csv which contains 3 Fields, "First Name", "Last Name" and "Gender".

Data.csv
FirstNameLastNameGender
RickRostMale
AlexHedleyMale
SueJonesFemale
FirstName,LastName,Gender
Rick,Rost,Male
Alex,Hedley,Male
Sue,Jones,Female

We can then create a simple webpage to mimic this:

	<html>
	<body>

	<h2>Customers</h2>

	<table border='1' width='100%' cellspacing='0' >
	<thead>
		<tr>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Gender</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td></td>
			<td></td>
			<td></td>
		</tr>
	</tbody>
	</table>

	</body>
	</html>
	

To display this data in the page you can add the TabularDataControl using the Obect tag.

This must have both an id and a Class ID: classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"

	<object id="data" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
	</object>
	

You can then add a number of parameters to this object to make it more functional.

Parameter Value Explanation
DataURL data.csv The relative file, i.e. this is in the same folder as the HTA.
UseHeader True Is there a Header in your file.
TextQualifier , It's a CSV so it's separated by commas (,), change this if necessary
SortColumn LastName;FirstName The Sort separated by ";"
Filter Gender = Male The WHERE clause
	<object id="data" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
		<param name="DataURL" value="data.csv">
		<param name="UseHeader" value="True">
		<param name="TextQualifier" value=",">
		<param name="SortColumn" value="LastName;FirstName"><!-- "-" to swap order -->
		<param name="Filter" value="Gender = Male">
	</object>
	

You then need to inform the display Table about the Data, this is done by giving the Table a datasource that matches the id.

	<object id="data" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
	</object>
	
	<table border='1' width='100%' cellspacing='0' datasrc=#data>
	</table>
	

The rows then need to be told what data to expect.

Add a div tag with a parameter of datafld and match up the Column headings.

	<div datafld="FirstName"></div>
	
	<table border='1' width='100%' cellspacing='0' datasrc=#data>
	<thead>
		<tr>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Gender</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				<div datafld="FirstName"></div>
			</td>
			<td>
				<div datafld="LastName"></div>
			</td>
			<td>
				<div datafld="Gender"></div>
			</td>
		</tr>
	</tbody>
	</table>
	

Finished page.

	<html>
	<body>

	<object id="data" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
		<param name="DataURL" value="data.csv">
		<param name="UseHeader" value="True">
		<param name="TextQualifier" value=",">
		<param name="SortColumn" value="LastName;FirstName"><!-- "-" to swap order -->
		<param name="Filter" value="Gender = Male">
	</object>

	<h2>Customers</h2>

	<table border='1' width='100%' cellspacing='0' datasrc=#data>
	<thead>
		<tr>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Gender</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				<div datafld="FirstName"></div>
			</td>
			<td>
				<div datafld="LastName"></div>
			</td>
			<td>
				<b>
					<div datafld="Gender"></div>
				</b>
			</td>
		</tr>
	</tbody>
	</table>

	</body>
	</html>
	

As you can see the Data is sorted and is filtered.

FirstNameLastNameGender
AlexHedleyMale
RickRostMale

The benefit here is that you can set it up once and then every time you get a new file created with new data just replace it in the folder and the HTA will update showing the new data with no configuration necessary.

You could build different view for different users.


Sample Files
Data.csv
TabularDataControl.hta


Index: Index | Lesson: Connect to Access db

 

Alex Hedley (Avatar) By: Alex Hedley


Click here to sign up for more FREE tips

 

 

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2023 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/8/2023 1:31:43 AM.