|
| |
Untitled Document
This document is split into the following sections.
- Configuring Fields in HTML Forms
- Programming Business Contact Sheet
- Programmer's guide for extreme development
1. Configuring Fields in HTML Forms
You can use the fields configuration page to configure your entry forms. This form can be found under settings > 'Configure Your Database' > Fields option. You would need administrative account to access this option.


Before using this tool, we recommend you to be little familiar with HTML Tags and their attributes. However you can still try various of the options using one by one and figure out results.

|
Sr. |
Field |
Type |
Property |
Source / Value |
Message |
Title |
* reqd |
Sr. will show you no. of rows.
Field Name column will show you a dropdown of all the fields from the table you have selected. Note that in order to configure fields you do not have to follow the sequential order of the fields of the table.
Field Type lets you configure the following field types, each one is explained below;
1. Text
2. Textarea
3. Select |
4. CheckBox
5. Radio
6. SQL |
7. Hidden
8. Label
9. Hidden + Label |
10. Password
11. Not Wanted
12. Link
13. File Or Image |
Property column lets you configure HTML properties of Field Type. For example, Text field size can be configured to 40 by including Size=40 in the property field.
Text given here will appear inside the tag of the fields such as;
<INPUT type=text name=task Size=40 >
or
<TEXTAREA Name=Address Rows=5 Cols=40>,
This would be the result of value 'Rows=5 Cols=40' in property field when the field type is text area.
Source field lets you define the data source in case of CheckBoxes, Radio, Select Boxes, SQL etc. This is explained in sections below.
Message allows you to define any message to be displayed at the time of entering the data of a particular field. such as please enter date in format DD MON YYYY
If the Title is specified, it is displayed instead of the usual field name.
*Reqd defines mandatory fields, and makes sure that those fields are filled before data goes into the database.
Examples;
You can configure a field for following behaviors (given with example);
Text - try Size=40 value to increase the size of text box (alternatively you can also use style tag i.e., style='width:100;')
Textarea - Try Rows=5 Cols=40 in properties field in order to define size of a Textarea Box.
Select - This one is for Dropdowns. To configure enter '1:Yes,0:No' in source field, and 1(or 0, i.e., value which will appear as selected value) in property field.
Check Box - If you want values from the database, enter a SQL query selecting two columns from database ID and its corresponding Text. Alternatively, enter '1:first value,2:second value' in Source Field.
Default values can be checked or unchecked based upon following parameters;
By default, all values will be unchecked.
In Property field,
If hyphen '-' is entered all values will be checked.
Alternatively, enter values you want to be selected in property fields and end them with comma, for example, it should appear like 1, 2, etc. the string should end with comma and a space to make it work.
When the form is submitted, values will be stored in comma separated format in the database. i.e., 1002, 1004, 1005
Radio Buttons - The usage is similar to the Check Box. When displayed in the form, you can select only one value out of all choices.
SQL - You can define a SQL query in Source field, this will fetch data from that particular table in the SQL Server and populate the dropdown. Make sure to select two columns from the table, first column will be mostly ID, and second will be text to be displayed in the dropdown. For example your SQL query should look like;
Select ID, Title From Status Where [Used For] Like 'Client'
You can have default selected by entering the value in Property field.
You also can generate a multiple select box by entering 'Multiple' text in Property field. This will be similar to Check Boxes, and the values will be stored in comma separated format. i.e., 1002, 1004, 1005.
Other Field Types
Hidden - Hidden fields are hidden variables which carries a value without showing it to end user. You can define it by entering a value in Source field. This also is used in order to hide parent table columns which are automatically taken by the system.
Hidden + Lebel - This is similar to the Hidden field. The only difference is that it shows the value while displaying all the fields and also makes a provision for sending the same value to the application when the form is submitted.
Label - At the time of data entry it allows user to enter a value, but at the time of editing record it will just show the value not allowing anyone to modify it.
Password - is a password field.
Not Wanted - The field would not be displayed in the form, neither it will store or retrieve any value. These are mostly used when you manually intend to use them by other means of programming.
Link - Used for linking a table to its parent table.
File Or Image - This is for storing documents or images. you must define File Folder in the properties window of any table before setting any field to this data type. Make sure these folders are into your web directory with write permissions. Refer online for setting permissions on your IIS.
2. Programming Business Contact Sheet
There are two basic files this application works on, i.e., PowerDB.asp, FormDB.asp. All Global Settings are in GlobalVars.asp. PowerDB.asp is responsible for displaying data and FormDB.asp create forms for data entry and edit. These files are written in ASP and it uses COM Component to do all database functions. Please note that these files are commonly used across presentation of all table in the database, hence one change in this file will reflect in entire of your application. See the section below "Programmers Guide for Advanced Development".
PowerDB and FormsDB uses set of functions to do their respective jobs, you can add your own functions or modify to tailor made this product.
PowerDB.asp
PowerDB.asp is responsible for displaying records and deleting records. All functions & subroutine to manipulate this program are stored in Recordfunctions.asp
How PowerDB Works.
The PowerDB is generally called by two parameters, TheTable and TheView. All records are displayed from the View (TheView) and data is entered, deleted and modified from the table (TheTable) name you pass. For example, to display Client's database, we will call PowerDB with following parameters;
PowerDB.asp?TheTable=Client&TheView=V_Client
Writing Codes in RecordFunctions.asp
All business logic or customized code is by practice stored in RecordFunctions.asp, this file contains following subroutines which effects the display of program at various places.
ManipulateProgram |
Before starting the program you can manipulate default configuration values here. |
BeforeRecordList |
A code written in this means that before recordlist is configured change following parameters. For example this subroutine may include;
If lcase(TheTable) = "Contact" Then
ParentTable="Client"
End if |
DisplayOtherDetails |
A code written here would be for the purpose for displaying details related to the page being displayed. For example this subroutine may include;
If lcase(TheTable) = "Contact" Then
ShowSummary "Client", LinkID
End if |
JustBeforeRecordList |
BeforeRecordList is configuring recordlist properties like its parent table, columns to be shown etc.
JustBeforeRecordList is mainly for the purpose of displaying related information for the table just before the recordlist begins, and after pagelinks and new record title is shown.
|
AfterRecordSet |
Finally when you have shown records, you may want to include legends etc., so this is the place to write code which displays information at the bottom. |
Hiding unwanted columns for display permanently
You can limit your columns display in record list both programmatically as well through configuring the properties of the table.
Method 1) Open config page, search for the table you want to configure, click on properties in Action links, Enter desired column numbers in Not Show field as comma separated values e.g., 3, 5, 9, 10, 11, 12
Method 2) Programmatically you can code in following fasion;
Sub BeforeRecordList
If LCase(theTable)="Contact" Then
NotShow="3, 5, 9, 10, 11, 12"
End if
End Sub
Displaying Child Records using PowerDB
Child tables contains parent column id as a foreign key, i.e., ParentTableID. To display child records, for example., this client has these many contacts, you would need to call powerdb.asp with one additional parameter i.e., LinkID, this would be the ID of the parent table, and value will be dynamically placed if you include <<0>> in the link, where 0 denotes the column value of the 0th number column in the record, this is typically the ID field value.
You also need to add OtherSearch=ClientID+Like+<<0>> to filter child record.
Making Child Link Work
Steps to place child links in records and customize forms to automatically connect child record with parent.
- Visit 'Configure Your Database' Section.
- Search for parent table, click properties and in Links textarea, enter the link for child table you are going to call from the parent table … for example if you want to link all contacts to a client;
<a href="PowerDB.asp?TheTable=Contacts&TheView=V_Contacts&LinkID=<<0>> &OtherSearch=ClientID+Like+<<0>>" >Contacts</a>
- Search for child table, click properties, enter parent table as name of the parent table, i.e., 'client', and close the window.
- click on fields link for the child table, edit form settings, make parent table ID columns i.e., 'ClientID' hidden.
- Go test if it is working successfully, go back and check your parent table, it should show a child link for 'Contacts' in action column and by clicking on this link you should see Child records along with the summary of the parent table of that record. Also test the forms for adding and editing, it should only add records within the parent table scope.
Additionally, you can pass &ParentTable=<<parenttablename>> to powerdb.asp. This can be very useful while programming when one table has multiple parents tables. For more information on this refer "Programmers guide for extreme development".
Other Properties
Property |
Detail |
Format |
Page links |
Links entered here appear on top of the page along with printer friendly version etc. |
Link, e.g.,
<a href="Help.htm">Help</a> |
Not Wanted |
Columns which are not wanted at the time of data entry. |
Hyphen separated, e.g., -5-7-8- |
Details Not Wanted |
Columns which are not wanted in Full Record View. |
Hyphen separated, e.g., -5-7-8- |
Report Title |
Title for your page, by default the table name. |
Text |
New Record Title |
By default, New Record link, enter in case you want users to restrict entering new records. |
Text |
Maximum Records |
A number defining no of records per page. |
Numeric |
Window |
Define window size for window opening for New Records, Edit and View. |
height=450, width=500 |
Update |
Default security right for updating records |
Yes / No |
Delete |
Default security right for updating records |
Yes / No |
Security No. |
A no given to the table. If user security number does not have the number, he will not be able to access this table. You can configure security numbers from settings in rights / security tables. |
Numeric |
FormDB.asp
FormDB.asp is responsible for displaying HTML Forms for Adding / Editing / Saving records into the database. These are controlled by multiple of functions & subroutines stored in FormFunctions.asp
How FormDB Works.
The FormDB is generally called from PowerDB which opens it in a new window by executing javascript function AddData written in PowerJS.js. AddData internally call FormDB with following parameters
FormDB.asp?Cmd=3&TheTable=Contact&TheView=V_Contact&LinkID=1021 &ParentTable=Client
Configuring FormDB.asp with FormFunctions.asp
All business logic or customized code is by practice stored in FormFunctions.asp, this file contains following subroutines;
MakeColLinks |
Define columns in recordlist which needs to be displayed as a link or email or thumbnail. This is explained later in this document. |
BeforeMakeForm |
Allows you to manipulate HTML Form, for example, removing and adding fields for data entry, adding separate header and footer to the forms etc. You can also use this subroutine for adding links for related master tables through coding. |
BeforeSave |
Before you save a record you might want to check if the data entered is proper, this is the place to add all your validations and customized code.
This place can be used for executing SQL queries before saving a record in the database, for example, other values directly can be added for the dropdowns by providing one extra text field along with the dropdowns. |
AfterSave |
For actions after you save a record. Like changing status of the Parent Record etc. |
please note that for uploading files, formdb_multipart.asp has been used which uses aspsmartupload component to upload files.
3. Programmer's guide for extreme development
Configuration values set by the GUI tool also can be controlled programming way.
The engine
Business Contact Sheet engine works on a COM component (tetractys). This component takes care of displaying record, displaying HTML Forms, saving record and deleting records. You can manipulate your programs by configuring various parameters.
The Tetractys COM Component, consist of the following three objects
RecordList
Recordlist Object takes inputs such as View Name, Maximum Number of Records Per Page, and additional Color Scheme inputs and throws output.
Cfg
The Cfg object is responsible for giving you properties stored for a table. Remember we stored some properties like the links, Parent Table etc. in config -> property for a table. Now these values gets stored in the database (TableCfg) and we retrieve it from the Cfg Object. This we do to pass on values to the RecordList object. In order to manipulate program, these variables are manipulated before they are passed on to the RecordList Object.
You can notice configuration values passed on to the Global Variables in GetCfg subroutine in Library.asp
Forms
Tetractys Form Object takes the Table Name as main input and its purpose is to generate HTML Form for the same table. The form is configured through various configurations stored in the database through config option.
Creating and using RecordList Object
To create RecordList Object.
Set Rec=Server.CreateObject("Tetractys.RecordList")
Usage
Rec.ShowRecord ShowOn, ColLinks, ColType
Where all three parameters are of collection (array) type.
ShowOn Colloection Parameter
ShowOn contains Boolean values of the field index to decide the column has to be shown or not. For example, if there are 10 fields in the table and 5, 7, 8 is not suppose to be show ShowOn will have following values;
Dim ShowOn(25)
For i=0 to 25 'where 25 is the limit of numbers of columns it will process for each view, you can increase this.
ShowOn(i)=1 ' by default all needs to be shown.
Next
ShowOn(5)=0 ' don't show column 5
ShowOn(7)=0 ' don't show column 5
ShowOn(8)=0 ' don't show column 5
In actual we pick up values from table properties in config and process it the following way;
Dim ShowOn(25)
For i=0 to 25
ShowOn(i)=1 ' by default all needs to be shown.
Next
For i=0 to Ubound(NotShow)
ShowOn(NotShow(i))=0
Next
Changing the display of the column by configuring - ColType
ColType is a collection parameter passed on to the method ShowRecord. This variable defines which column needs to be a link, or an email link or an image thumbnail. This is used with ColLinks in order to define source.
E.g., for making column values a link
Dim ColType(10)
Dim ColLinks(10)
ColType(1)=1 ' First Column is a link
ColLinks(1)="<a href=SpaceShuttle.asp?ID=<<0>>"
Here we are making the first column as a link for SpaceShuttle.asp and passing a unique ID of record to the program by including <<0>> inside this link. <<0>> will be replaced by the value of Column value of zero 0 number column, i.e., ID.
Similarly passing value 2 means that this is an email address.
ColType(1)=2 ' First Column is an email link
Value 3 means that this is an image.
ColType(1)=3' First Column is an image
Ouptput Methods
Rec.RecordCount |
Returns a numeric value, for total number of records found in the database. |
Rec.SearchForm |
Returns a Search Form as String, for filtering records. |
Rec.PageLinks |
Returns pages navigation divided by maximum no. of records |
Rec.RecordSet |
Returns Records for the Current Page. |
Properties or configurations for output
Rec.Title |
Title of the RecordList. |
Rec.TableName |
Generally a View Name is passed instead of Table Name. |
Rec.SQL |
Pass a SQL Query instead of the View Name, or check what SQL Query is being executed. |
Rec.SelfFileName |
Self file Name. The file from where this code is being executed. |
Rec.DoSearch |
Pass Boolean value 1, If the filter record search is needed and 0 if not required. |
Rec.iNoOfForms |
If Search is required, how many forms do you require, pass between 1-3. |
Rec.MaxRecords |
Maximum number of records per page. Pass numeric value. |
Rec.Links |
Action Links for each records. |
Rec.OtherSearch |
Pass a SQL Query conditions, this will be added to your SQL Query which finally will get executed. e.g.,
[City] Like 'Mumbai' |
More Options
Rec.TBorderColor |
Border Color for the table. RGB Value in hexadecimal, e.g., 1D7B99 |
Rec.THColor |
Header Row Color, RGB Value in hexadecimal, e.g., 037BA6 |
Rec.TRColor |
Row Color, Comma Separated alternative RGB Value in hexadecimal, e.g., 048BB5, 048BB5 |
Rec.THFontColor |
The font Color of the Header Row, |
Rec.TWidth |
Width of the Table, numeric or percentage value. |
Rec.TBorderSize |
Size of the Table Border, a numeric value. |
Rec.AdditionalButtons |
For adding additional buttons beside Delete button. |
Advanced
Rec.CanDelete |
1 you can, 0 You cannot. |
Rec.CanUpdate |
1 You can, 0 you cannot. |
Rec.OrderString |
String for Order By clause in SQL, e.g.,
'ID Desc' |
Rec.PageHiddenField |
If you are passing additional hidden fields to manipulate program, it should also get included in paging links. You have to pass these variable in similar fashion you do in QueryString. E.g., 'LinkID=1008&CMD=10' |
Rec.SrchHiddenField |
Similar to the earlier option, but this one goes in the Search Form, so you need to include these with input hidden fields. E.g.,
<input type=Hidden Name=CMD value=3> |
- The Form Object
To create Form object;
Set Obj=Server.CreateObject(Tetractys.Forms)
The Form object is divided into four segments.
- Making HTML Forms
- Saving Records
- Deleting Records
- Viewing a Record
All procedures take following value before executing component.
Obj.con="Connection string to your database."
a. Making HTML Forms.
Usage
Obj.MakeForm TheTableName
Pass the table name to this method and it will generate you a HTML Form for data entry or editing a record. The output is effected by the configurations you have done in the config sections explained earlier and by some of the properties given below.
Properties
Obj.con |
Connection string to the database. |
Obj.RecordID |
Pass the record ID, if you want a modification of the record. Do not pass anything if a new record has to be added. |
Obj.SetTitle |
Pass title to the form, generally the Table Name. |
Obj.notWanted |
Pass hyphen separated values, e.g., -3-5-9-
Make sure to begin and end with hyphen.
These settings are picked up from config but can be changed within the program. |
Obj.LinkID |
Pass the parent record ID here. This is for linking the record to its parent table. |
Obj.Action |
The file name where the action will be taken. This is same as Action Property of Form tag in HTML. E.g., <Form Action=#FileName# Method=POST > |
|
|
More Options
Obj.TRColor |
Row color of the form, pass comma separated hexadecimal RGB value. E.g.,
048BB5,048BB5 |
Obj.BorderColor |
Border color of the form, pass hexadecimal RGB value. |
Obj.Vertical |
1 if you want form to be vertical, 0 if it is horizontal |
Obj.SubmitButton |
Pass a button tag if you do not want the default one. E.g.,
<input type=Submit Value="Save" > |
Obj.BeforeHTML |
Additional HTML before the Form is generated. E.g., |
Obj.AfterHTML |
Additional HTML After the Form is generated. E.g., |
Advanced
Obj.otherhiddenfield |
If any other hidden fields you may want to add, these will be HTML Hidden fields.
<input type=Hidden name=CMD value=3> |
Obj.ColumnValue |
Pass an array with any default values for each column. For example, third column may have text 'hello' inside when form data entry appears. For this you may add
Dim DefVal(100)
DefVal(3)='Hello'
Obj.ColumnValue=DefVal |
|
|
b. Saving a record
Usage
obj.SaveForm
Properties
obj.con |
Connection string to the database. |
obj.AutoIncrement |
1, if the table id is auto increment. 0, if the new ID is picked up from an ID Table which stored latest ID of this table.1 |
obj.IsDebug |
1, if the form is being debugged, this will show you SQL Query which will be fired instead of firing a SQL query. |
obj.IsFormSaved |
Return value 1 if form is successfully saved. |
c. Deleting Records
Usage
obj.Delete TheTableName, DeleteIDs
It takes two parameter, one the table name from where the records will be deleted, and the other one DeleteIDs will take multiple IDs of the table which will be deleted.
d. Viewing a Record
Usage
OBJ.ViewRecord TheView,ID
This takes two paramenter one the View Name and the other one the ID no of which record will be shown.
Obj.con |
Define the database connection string here |
Obj.notWanted |
Details which are not wanted |
Obj.Titles |
Pass the title of the record. |
More Options
obj.TRColor |
Comma separated hexadecimal values. E.g.,
048BB5,048BB5 |
obj.BorderColor |
The color of the border of the Table. E.g.,
1D7B99 |
|
|
Additional Functions & Subroutine
DecideHashes
Hashes, are fillers in the SQL Query attach to a dropdown fields in HTML forms. These Hashes are placed in Configure Your Database -> fields form, in source of a dropdown;
For example, you can have a dropdown field with following source
Select * from Projects #1
#1 is kept as a filler number 1. This can be assigned a value at the time of writing program. for example;
If LCase(TheTable)="client" Then
'#1 is replaced with client id to show only projects of that particular client
obj.HashValue="#1: Where ClientID = 1001"
End if
Finally the program will execute following query;
Select * From Projects Where ClientID = 1001
CountRows
This function counts the number of rows in a table. This takes two parameters;
CountRows(TableName, Filter)
e.g.,
CountRows("Project","Where ClientID=1001")
ShowSummary
Shows a record in summary format. Can be used for showing parent record before child records are shown.
Usage;
ShowSummary ViewName, ID, DontShow, ShowOnly
Example;
ShowSummary "V_Inquiry",LinkID,"-12-13-14-25-",""
Or
ShowSummary "V_Inquiry",LinkID,"","-12-13-14-"
Please Note: A similar function can be accessed from CFG Object also.
GetIDs
Get values for the corresponding IDs.
Usage;
GetIDs(IDs, Tablename)
E.g.,
GetIDs("1002,1004,1005", "Client")
This will return title from client table of 1002, 1004, 1005 IDs.
HasAccess
Returns if current logged on user has access to a particular security number.
Usage;
HasAccess(Security Number)
Return 1, if current logged on user has access, 0 if not.
Example,
If HasAccess(3) Then
' Let him update records
CanUpdate=1
End if
|