Monday, September 17, 2012

Interwoven Teamsite Form publisher.

Interwoven's TeamSite product includes a feature called FormsPublisher. This is useful for scenarios where an information worker needs to contribute to the web site, but lack HTML and CSS skills. This type of user can complete a form, let the system validate it, and then press a button to have the system generate the equivalent HTML page.
The form can include validation, business logic, database queries or anything else you can dream up. While an HTML expert would prefer their favorite text editor and complete control to the HTML page. An information worker without HTML skills can now edit an existing page, based on an customized form. Now the challenge shifts to having the information worker select the appropriate form to build the page.

A developer configures a set of files and folders to support this process. At a high level, there are three parts in motion. The Data Capture Template (DCT) is an XML file that describes how TeamSite should present the form to the information worker. A Data Content Record (DCR) is an XML file that contains an instance of a form completed by an information worker. You launch TeamSite, click File, New Form Entry and select the form you want to complete. Next, the given form appears in the browser. The fields of the form are defined by the DCT. After you click the Save button, the field values are serialized into a DCR file. These files are organized in a collection of folders on the TeamSite server; one folder per form. Each folder has a conventional set of child folders to hold the DCR files as well as the presentation template file(s), These are the files with the .tpl file extension.
A presentation template converts a DCR into something else. Most of the time, at least for me, that something else will be an HTML page. Imagine a single DCR file that contains both public and private information for a company; perhaps the DCR contains public information about a single product as well as private information for their tech support staff. The DCR file can be send around via workflow for approval and the finally be ran through both sets of presentation templates which results in two different HTML files - one file is deployed to the public and the other file is kept on the Intranet. Both files are assured of having the appropriate content via the approval process and the presentation templates apply the correct branding and layout. This model supports a good workflow model as well as good separation of design from content. Its just one example of using the FormsPublisher in the enterprise.


Tuesday, September 4, 2012

Sql Triggers

As a simple definition we can say that
" A trigger is a database object that is attached to a table"

Triggers is  only fired when an INSERT, UPDATE or DELETE occurs in any Data base table.We specify the action to fired the trigger. As per example.

SET NOCOUNT ON

CREATE TABLE Student (St_ID int IDENTITY, St_Desc varchar(10))
go
CREATE TRIGGER tr_Source_INSERT
ON Student
FOR INSERT
AS
PRINT GETDATE()
go
INSERT Student (St_Desc) VALUES ('Test 1')

-- Results --

Apr 28 2001  9:56AM
 
Another example of triggers will be clear the idea.
 
CREATE TABLE Orders (Ord_ID int IDENTITY, Ord_Priority varchar(10))
go
CREATE TRIGGER tr_Orders_INSERT
ON Orders
FOR INSERT
AS
IF (SELECT COUNT(*) FROM inserted WHERE Ord_Priority = 'High') = 1
 BEGIN
  PRINT 'Email Code Goes Here'
 END
go
INSERT Orders (Ord_Priority) VALUES ('High')

-- Results --

Email Code Goes Here 

Triggers make use of two special tables called inserted and deleted.
 The inserted table contains the data referenced in an INSERT before it 
is actually committed to the database. The deleted table contains the 
data in the underlying table referenced in a DELETE before it is 
actually removed from the database. When an UPDATE is issued both tables
 are used. More specifically, the new data referenced in the UPDATE statement is contained in inserted and the data that is being updated is contained in deleted.