Saturday, December 31, 2011

Happy New Year to All

Bye Bye 2011, Welcome Mr. 2012...

Wish you a wonderful New Year 2012 to All

Friday, December 30, 2011

Useful Shortcut in Notes - Logoff and Navigation

Ctrl+f5- Logoff notes environment

Ctrl+f8- Navigation in client and Designer too

Excel Graph in Lotus Notes

Step1:

create form and give name as “frmexcelchart” and make sure the form contains rich text field , which name is chart

step2:

create action button on which view you want to get chart…. make sure all field map in view. and put the following code in that button

Sub Click(Source As Button)

On Error Resume Next

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim view As NotesView

Dim uidoc As NotesuiDocument

Dim xlApp As Variant

Dim i As Integer

Dim j As Integer

Set view=session.CurrentDatabase.GetView(”vwStudentMark”)

Set xlApp = CreateObject(”Excel.application”)

xlApp.Visible = False

xlApp.Workbooks.Add

For i=1 To view.ColumnCount

j=1

Forall x In view.GetColumnValues(i-1)

xlapp.cells(j,i+1)=x

j=j+1

End Forall

Next

Xlapp.cells.select

Xlapp.charts.Add

Const xlLocationAsObject = 2

With xlApp.ActiveWorkbook.ActiveChart

.Name = “Student Mark system”

.HasTitle = True

.Axes(2).HasTitle = True

.Axes(2).AxisTitle.Characters.Text = “Mark”

.Axes(1).HasTitle = True

.Axes(1).AxisTitle.Characters.Text = “Student Name”

.HasLegend = True

.ChartTitle.Text = “Student Mark Chart”

.ChartType = “98″

.PlotArea.Interior.ColorIndex = “0″

.Location xlLocationAsObject, “Student Mark System” ‘move chart to worksheet

End With

xlApp.ActiveSheet.ChartObjects(”Chart 1″).Activate

xlApp.ActiveChart.ChartArea.Select

xlApp.ActiveChart.ChartArea.Copy

Set uidoc = workspace.ComposeDocument(”",”",”frmexcelchart”)

Call uidoc.GotoField(”chart”)

Call uidoc.Paste

xlApp.ActiveWorkbook.saved = True

xlApp.quit

End Sub

step3:

Save , run then click button, you can get graph

Create document from Text file in Lotus Notes

This article about import data from txt document .

Step 1:

create one .txt document like below.

“mahendran”,”9003544190″
“Ramya”,”9948484884″
“hi”, “8585885858″

“mahendran”,”9003544190″

“Ramya”,”9948484884″

“krishna”, “8585885858″

and save name as test

Step 2:

create one form and name as “mahe” and create two field (i) name1 (II) mobile

save the form and map this form to one view and also map field to columns

Step3:

create one lotus script agent and paste following code

Option Public

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim uiws As New NotesUIWorkspace

Dim fileCSV As Variant

‘Declare variables to hold data

Dim Name1 As String

Dim mobile As String

Dim counter As Integer

Dim doc As NotesDocument

counter =0

’setup file number

filenum% = FreeFile()

‘Ask user for file location

fileCSV = uiws.OpenFileDialog(False, “Choose the CSV file”,”*.txt” ,”c:\temp”)

‘If the user chose a file then process

If Not IsEmpty(fileCSV ) Then

Open fileCSV(0) For Input As filenum%

Do Until EOF(filenum%)

‘Read a line of data

Input #filenum%, name1, mobile

‘Create Notes document and write values to it

Set doc = db.CreateDocument

With doc

.name1=name1

.mobile=mobile

.form=”mahe”

End With

’save document

Call doc.save(False, False)

counter = counter +1

Loop

MsgBox “You imported ” & counter & ” records.”

End If

End Sub

Step 4:

run the agent and select test.txt and go back to view you can see imported file

dojo introduction

Hi,

I am stepping into Dojo tool kit. It really cool design. So keep visit my post. Hope you know lot about dojo Design.

Here that means already someone post tooltip. so i am skip that and going to tell in little advance.dojotip

Can you guess what function above.

When you open that window only Register button show. but when u click Register it popup one window that It holding two field as like as above image.

Before step in we need to know what think done.

Step1:

dojoParseOnLoad=”true”

dojoTheme=”true”

Step 2:

Need to include what are module( say function) going to use

Ex:
<xp:this.resources>
<xp:dojoModule name=”dijit.form.DropDownButton”>
</xp:dojoModule>
<xp:dojoModule name=”dijit.TooltipDialog”></xp:dojoModule>
</xp:this.resources>

<xp:this.resources>

<xp:dojoModule name=”dijit.form.DropDownButton”>

</xp:dojoModule>

<xp:dojoModule name=”dijit.TooltipDialog”></xp:dojoModule>

</xp:this.resources>

Step 3:

Include your dojo module

Ex:

<div dojoType=”dijit.form.DropDownButton”>

<xp:button value=”Register” id=”label3″></xp:button>

<div dojoType=”dijit.TooltipDialog”>

<xp:label value=”name” id=”label1″></xp:label>

<xp:inputText id=”inputText1″></xp:inputText>

<xp:label value=”mobile number” id=”label2″></xp:label>

<xp:inputText id=”inputText2″></xp:inputText>

</div>

</div>

Explanation Above code

The first line < div dojoType=”dijit.form.DropDownButton”> It describe the under components going to act drop down button

<xp:button value=”Register” id=”label3″></xp:button> This is component to act drop down

<div dojoType=”dijit.TooltipDialog”>- Descripe tool tip dialog. Under which going to appear in dialog box.

Full code:

<?xml version=”1.0″ encoding=”UTF-8″?>

<xp:view xmlns:xp=”http://www.ibm.com/xsp/core” dojoParseOnLoad=”true”

dojoTheme=”true”>

<xp:this.resources>

<xp:dojoModule name=”dijit.form.DropDownButton”>

</xp:dojoModule>

<xp:dojoModule name=”dijit.TooltipDialog”></xp:dojoModule>

</xp:this.resources>

<div dojoType=”dijit.form.DropDownButton”>

<xp:button value=”Register” id=”label3″></xp:button>

<div dojoType=”dijit.TooltipDialog”>

<xp:label value=”name” id=”label1″></xp:label>

<xp:inputText id=”inputText1″></xp:inputText>

<xp:label value=”mobile number” id=”label2″></xp:label>

<xp:inputText id=”inputText2″></xp:inputText>

</div>

</div>

</xp:view>
Note:
After copy and paste the following code make sure that whether double quote come correctly

Hide control using Css style

Here i discussed about Hide x-page control using Css style. if u want to hide any control select that control and go to source and put following line

style=“display:none”

Ex:

<?xml version=”1.0″ encoding=”UTF-8″?>

<xp:view xmlns:xp=”http://www.ibm.com/xsp/core”>

<xp:inputText id=”inputText1″ style=“display:none”></xp:inputText>

</xp:view>

dijit.Dialog in Dojo

Here i given example for how you increase your Dojo dialog Size and add title.


Souce code:

<?xml version=”1.0″ encoding=”UTF-8″?>

<xp:view xmlns:xp=”http://www.ibm.com/xsp/core” dojoParseOnLoad=”true”

dojoTheme=”true”>

<xp:this.resources>

<xp:dojoModule name=”dijit.Dialog” ></xp:dojoModule>

</xp:this.resources>

<div dojoType=”dijit.Dialog” id=”test” title= “My Dialog” style= “width: 300px ;height:200px”>

<xp:label value=”Test Dialog create by dojo” id=”label1″></xp:label>

</div>

<xp:button value=”Label” id=”button1″>

<xp:eventHandler event=”onclick” submit=”false”>

<xp:this.script><![CDATA[dijit.byId("test").show()]]></xp:this.script>

</xp:eventHandler></xp:button></xp:view>


<?xml version=”1.0″ encoding=”UTF-8″?>


<xp:view xmlns:xp=”http://www.ibm.com/xsp/core” dojoParseOnLoad=”true”


dojoTheme=”true”>


<xp:this.resources>


<xp:dojoModule name=”dijit.Dialog” ></xp:dojoModule>


</xp:this.resources>


<div dojoType=”dijit.Dialog” id=”test” title= “My Dialog” style= “width: 300px ;height:200px”>


<xp:label value=”Test Dialog create by dojo” id=”label1″></xp:label>


</div>


<xp:button value=”Label” id=”button1″>


<xp:eventHandler event=”onclick” submit=”false”>


<xp:this.script><![CDATA[dijit.byId("test").show()]]></xp:this.script>


</xp:eventHandler></xp:button></xp:view>


Explanantion:


Title attribute used for add title to dojo dialog and style attribute used for alignment and size


Creating a New Symphony Document using LotusScript

Now its very easy to create a new symphony document/spreadsheet using LotusScript.
Step 1: Just create a new form an create an actions and name it as “Generate Symphony Document”.
Step 2: Then include Lotusscript Source(LSS) file in options as follows,
%INCLUDE “symphonylsx.lss”
Step 3: Now you can access the Lotus Symphony classes.

Symphony Application
Step 4: Now write the following code in the action.

Sub Click(Source As Button)
On Error Goto errorHandler
Dim symdoc As SymphonyApplication
Set symdoc = New SymphonyApplication

Dim documents As SymphonyDocuments
Set documents = symdoc.Documents

Dim document As SymphonyDocument
Set document = documents.AddDocument(”",True,True) ‘ Syntax is below
‘Set document = documents.AddDocument(Template, AsTemplate, Visible)

Dim range As SymphonyTextRange
Set range = document.Content.End

Call range.InsertBefore(”My Symphony document”)
Exit Sub
errorHandler:
Msgbox “Error “& Chr(34) & Error() & Chr(34) & ” on Line number ” & Erl()
Exit Sub
End Sub

Step 5: Now preview the form and click the action button. A new symphony document will open and “My Symphony document” is written in that document.
Generated symphony document
Note : If you want the properties and methods of the symphony class, for help see the reference tab in left side of the programming pane while writing code.
reference
We will discuss more about this in next post.

Anotomy of Note ID

Actual Note Id information of a document will be displayed as follows,

ID: OF0000039D:3836C29F-ON85255DC9:0056FB94
SD00255DF4:0057B8FA-SN00000003
DB85255CD9:00567287-NT0000C092

There are 6 parts in note ID. They are

1. UNID (Universal Note ID)

UNID consists of originator File and originator note.(1st Line)

    Universal Note ID (UNID) =
    ID: OF0000039D:3836C29F-ON85255DC9:0056FB94
    SD00255DF4:0057B8FA-SN00000003
    DB85255CD9:00567287-NT0000C092

Every replica of a note has the same UNID, and the UNID does not change when a note is modified.

2. OID (Originator ID)

OID = UNID + Sequence No and Sequence Time

    Originator ID (OID) =
    ID: OF0000039D:3836C29F-ON85255DC9:0056FB94
    SD00255DF4:0057B8FA-SN00000003
    DB85255CD9:00567287-NT0000C092

Every replica of a note has the same OID, but the OID changes when the note is modified.

The changes will occur only in Sequence No and Sequence Time part not in UNID.

3. NID (Note ID)

Note ID =
ID: OF0000039D:3836C29F-ON85255DC9:0056FB94
SD00255DF4:0057B8FA-SN00000003
DB85255CD9:00567287-NT0000C092

The NID does not contain information about the database being referred to, and it does not change when the note is modified.

4. GNID (Global Note ID)

GNID = Database ID + NID

    Global Note ID (GNID) =
    ID: OF0000039D:3836C29F-ON85255DC9:0056FB94
    SD00255DF4:0057B8FA-SN00000003
    DB85255CD9:00567287-NT0000C092

The GNID does not change as the note is modified. The GNIDs of replica copies of a note will probably be different, since the various copies will occupy different positions in their databases.

5. IID (Instance ID)

The Instance ID consists of the note’s modification TIMEDATE and the note ID.

The IID does not contain information about the database being referred to. The IID changes when the note is modified

6. GIID (Global Instance ID)

The GIID contains information about the database being referred to. The GIID changes when the note is modified

$V2AttachmentOptions - Reserve field

When we are saving a document with attachments, the attachments will be visible in the bottom of the document on both web and in client.

Its not a good manner to show attachments in the bottom of the document. So we want to hide the attachment.

A reserved field is used to hide the attachments. That field is “$V2AttachmentOptions”.

If value = “0″ –> not to display attachment icons

Note: Most of the times this will not work so follow the following method to hide the attachment icons.

Place

Creating New Files using Lotus Script Freefile()

There is a excellent way to create a new file of our own in any type using LotusScript.

Eg: We can create any type of file just by changing the extension of the file name.

Here is the sample code to create a file using lotusScript.

Dim ses As New NotesSession
Dim fileNum As Integer
Dim fileName As String

fileNum% = Freefile()
fileName$ = ses.GetEnvironmentString(”Directory”,True) +”\test.txt”
Open fileName$ For Output As fileNum%
Print #fileNum%, “I have created a new text file”
Exit Sub

We can also create a word/Excel/Rich Text File/* by changing the extension as .doc/.xls/.rtf/.*

I think its very useful for you legends to go ahead.

$Formulaclass- Reservefield

We know that, we can see the saved documents in database in views.

Is there any chance to view all design elements in a single view?

Yes, we can view those design elements in view by changing the value of reserved field.

Hint: Fields name start with $ be the reserve field.

In view there is a reserve field called $FormulaClass. As default its value is 1. If the value is 1, it shows only the saved documents in the view.


Value of $FormulaClass Viewing Elements

1 Documents

4 Forms and Subforms

8 Views, Folders and Navigators

16 Database Title

32 Design Collection

64 ACL Note (in compiled format)

512 Agents (Shared)

1024 Shared Fields

1548 Forms, Sub-forms, Views, Folders, Navigators, Agents(Shared), Shared Fields

If we change the value of &FormulaClass into 1548(sum of 4 + 8 + 512 + 1024) it shows all Forms, Sub-forms, Views, Folders, Navigators, Agents (Shared), Shared Fields.

For Example: Follow the below steps to get clear idea on that.

Step 1: Create a new view named as “ViewDesignElements”(user defined name) and give “SELECT @All” as view selection formula in programming pane.

Step 2: Create two columns and name as “Design Element Type” & “Design Element Name”.

Step 3: For “Design Element Name” column give “$Title” as formula for column value. And categorize “Design Element Type” column.

Step 4 : Then create an LotusScript Agent and name it as “designAgent”.

Step 5 : Type the following code in Initialize of the agent.

This script is to change the value of “$FormulaClass”.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set view= db.GetView(”ViewDesignElements”)

Set doc = db.GetDocumentByUNID(view.UniversalID)

Call doc.ReplaceItemValue(”$FormulaClass”, “1548″)

doc.Save True, True

End Sub

Step 6 : Create an action button in the view to run the agent by event. Now enter the following code for action button.

@Command([ToolsRunMacro];”designAgent”)

Step 7 : Now Preview the view and click the action button. It will run agent and changes the $FormulaClass value as 1548 to view all design elements.

Step 8 : Then press Shift + F9 to refresh. It will show all the design elements.

Field Validation in AJAX in an Efficient Manner

Here is a simple way to validate mandatory fields, if they a more. Don’t waste your time to write a separate code for each and every fields.

I have done a simple validation in javascript for checking that the field not be null.

Step 1: Create a hidden field and name it as of your wish (name of the field may be “MandatoryFields”).

Step 2: Give all the mandatory field names with comma separator as the default value of the hidden field as shown below.


Step 3: Put the following function in JSHeader.


function validateSupplier()

{

var f=document.forms[0];

var fieldsString= f.MandatoryFields.value;

var MandatoryFields = fieldsString.split(”,”);

var ValidatedFields=0;

for(var i=0; i

{

var fieldValue = eval(’f.’+Ma ndatoryFields [i]+’.value’);

if(trim(fieldValue)==”")

{

alert(”Please fill all the mandatory fields for Supplier Information”);

eval(’f.’+MandatoryFields[i]+’.focus()’);

return false;

break;

}

else

{

ValidatedFields=ValidatedFields+1;

if(ValidatedFields==MandatoryFields.length)

{

return true;

}

}

}

}

/* Function used to trim string */

function trim(str)

{

if(!str || typeof str != ’string’)

return “”;


return str.replace(/^[\s]+/,”).replace(/[\s]+$/,”).replace(/[\s]{2,}/,’ ‘);

}

/********** Trim Ends *******/

Step 4: Write the following code in “onclick()” of a submit button.

var success = validateSupplier();

if(success)

{

document.forms[0].submit();

}

Its the smarter way to validate similar validation for multiple fields.

We can also validate for the datatypes in the same way.

function validateSupplier()
{
var f=document.forms[0];
var fieldsString= f.MandatoryFields.value;
var MandatoryFields = fieldsString.split(”,”);
var ValidatedFields=0;
for(var i=0; i
{
var fieldValue = eval(’f.’+MandatoryFields[i]+’.value’);
if(trim(fieldValue)==”")
{
alert(”Please fill all the mandatory fields for Supplier Information”);
eval(’f.’+MandatoryFields[i]+’.focus()’);
return false;
break;
}
else
{
ValidatedFields=ValidatedFields+1;
if(ValidatedFields==MandatoryFields.length)
{
return true;
}
}
}
}
/* Function used to trim string */
function trim(str)
{
if(!str || typeof str != ’string’)
return “”;
return str.replace(/^[\s]+/,”).replace(/[\s]+$/,”).replace(/[\s]{2,}/,’ ‘);
}
/********** Trim Ends *******/

function validateSupplier()

{

var f=document.forms[0];

var fieldsString= f.MandatoryFields.value;

var MandatoryFields = fieldsString.split(”,”);

var ValidatedFields=0;

for(var i=0; i

{

var fieldValue = eval(’f.’+MandatoryFields[i]+’.value’);

if(trim(fieldValue)==”")

{

alert(”Please fill all the mandatory fields for Supplier Information”);

eval(’f.’+MandatoryFields[i]+’.focus()’);

return false;

break;

}

else

{

ValidatedFields=ValidatedFields+1;

if(ValidatedFields==MandatoryFields.length)

{

return true;

}

}

}

}

/* Function used to trim string */

function trim(str)

{

if(!str || typeof str != ’string’)

return “”;


return str.replace(/^[\s]+/,”).replace(/[\s]+$/,”).replace(/[\s]{2,}/,’ ‘);

}

/********** Trim Ends *******/

Step 4: Write the following code in “onclick()” of a submit button.

var success = validateSupplier();

if(success)

{

document.forms[0].submit();

}

Its the smarter way to validate similar validation for multiple fields.

We can also validate for the datatypes in the same way.

Export all view data to Symphony SpreadSheet(.ods) from Web

Create a button and call the following agent in onclick() of that button.

Note : For better output you have to map all required fields in the view.

Sub Initialize

On Error GoTo errorHandler

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim stuDetailsView As NotesView

Dim viewEntryCollection As NotesViewEntryCollection

Dim viewEntry As NotesViewEntry

Dim fileName As String

Dim i As Integer

Dim j As Integer

Dim cnam As Variant

Set db = session.CurrentDatabase

Set stuDetailsView = db.GetView(”vwStudent”)

‘Assign ‘vwStudent’ view as NotesView

Set viewEntryCollection = stuDetailsView.AllEntries

‘ViewEntryCollection contains the handle of all documents in the view

Set viewEntry = viewEntryCollection.GetFirstEntry

‘View Entry have the handle of first document from the ViewEntryCollection

fileName = “Web All Documents.ods”

‘File name of the Symphony spreadsheet with ‘ods’ extension

Print |Content-Type:application/Lotus Symphony Spreadsheet in Lotus Notes.exe|

Print |Content-Disposition: Attachment; fileName=”|+fileName+|”|

‘To display a prompt to user to save or open

Print “

‘Writing into the spreadsheet and creating/opening a table

Print “

‘Writes the Column header in the first row

For j=1 To stuDetailsView.EntryCount

‘Loop runs for all documents in the view and exits

Print “

For i=0 To stuDetailsView.ColumnCount-1

‘Loop runs for all columns in the each documents in the view

Print “

‘Writes all column values in the spreadsheet corresponding to the view

Next i

Set viewEntry=viewEntryCollection.GetNextEntry(viewEntry)

‘ Getting the next entry from the collection

Print “

Next j

Print “

Student NameStudent RegNoDate of BirthDepartmentBatchCollege Name
” & viewEntry.ColumnValues(i) & “
‘Closes the table

Exit Sub

errorHandler:

Print “Error :” & Error() & “Line No :” & Erl()

‘ Prints the error and the line number where the error occurs

Exit Sub

End Sub

Export all view data to Symphony SpreadSheet (.ods) from Notes

Call the following agent in an action button to export selected documents in the view to symphony Spreadsheet.

Note : For better output you have to map all required fields in the view. And it will also ask the path to save the file which contains the exported data.

Sub Initialize

On Error GoTo errorHandler

Dim ses As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim stuDetailsView As NotesView

Dim viewEntryCollection As NotesViewEntryCollection

Dim viewEntry As NotesViewEntry

Dim i As Integer

Dim j As integer

Dim cnam As Variant

Set db = ses.CurrentDatabase

Set stuDetailsView=db.GetView(”vwStudent”)

‘Assign ‘vwStudent’ view as NotesView

Set viewEntryCollection=stuDetailsView.AllEntries

‘ViewEntryCollection contains the handle of all documents in the view

Set viewEntry=viewEntryCollection.GetFirstEntry

‘View Entry have the handle of first document from the ViewEntryCollection

Dim fileNum As Integer

Dim fileName As String

fileNum = FreeFile()

‘Gives a file number between 0 to 255 which is currently free

Dim saveas As Variant

saveas = ws.SavefileDialog(False,,”Symphony Word | *.odt”,,”All Documents To Symphony Word.odt”)

‘Opens a file save dialog box and ask user where to save the Created document, The file name is default

If IsEmpty(saveas) Then

Exit sub

End If

fileName = saveas(0)

‘Assigning the filename with full path which is given by the user

Open fileName For Output As fileNum

‘Opens the created file with reference to the file number and ready to write in it

Print #fileNum,”

Student Details

‘ Document heading

Print #fileNum,”

‘Creates a table in center of the Symphony Document

Print #fileNum,”

‘Writes the Column header in the first row of the table

For j=1 To stuDetailsView.EntryCount

‘Loop runs for all documents in the view and exits

Print #fileNum,”

For i=0 To stuDetailsView.ColumnCount-1

‘Loop runs for all columns in the each documents in the view

Print #fileNum, “

‘Writes all column values inside the table in the documents corresponding to the view

Next i

Set viewEntry=viewEntryCollection.GetNextEntry(viewEntry)

‘ Getting the next entry from the collection

Print #fileNum,”

Next j

Print #fileNum,”

Student NameStudent RegNoDate of BirthDepartmentBatchCollege Name
” & viewEntry.ColumnValues(i) & “

‘Closes the table

Close fileNum

Print “Symphony Document Report Generated Successfully”

‘Displays this message in the status bar

Exit Sub

errorHandler:

MsgBox “Line No :” & Erl()& Chr(13) &”Error : ” & Error()

‘ Prints the error and the line number where the error occurs

Exit Sub

End Sub

@DbColumn and @DbLookup in AJAX

Its very simple and easier get DBColumn and DBLookup using AJAX.

Click the following link for more details and full code.

http://www.antcer.it/lotus-domino/dbcolumn-e-dblookup-usando-ajax/

http://www.antcer.it/tag/dblookup/

Adding New Record : ODBC Connection in Notes

It is similar to creating ODBC connection in java.

Create a agent for Adding new record to MS-Access

Step1: Create a connection to ODBC for accessing database.

Step2: Mention the name of the table and get a query for insert record.

step3: Call this agent from view.

Sample coding:

Dim con As New ODBCConnection ‘ Declare con object for connect to database.

Dim qry As New ODBCQuery ‘Declare qry variable as ODBCQuery

Dim res As New ODBCResultSet ‘Declare res for get the records

Dim i As Integer

Dim b As Boolean

If Con.ConnectTo(”DBs”) Then ‘Here create a connection to data source

Set Qry.Connection = Con

Qry.SQL = “select * from stdu1″ ‘Create a query for get all records from table

Set Res.Query = Qry

Res.Execute

addnew:

Res.addrow ‘Create a object for adding new record

‘Add new value to specified Column

Call res.Setvalue(”RollNo”,CInt(InputBox(”Enter Roll No”,”")))

Call res.setvalue(”Name”,InputBox(”Enter name”,”"))

MsgBox (”The given row was succesfully added.”)

Call res.Updaterow() ‘Here refresh the table after adding new values

i=ws.Prompt(2, “New Record”, “Do you want to add new record”)

If i=1 Then

GoTo addnew ‘User want to add new record again then repeat the above processes

End If

Res.Close(DB_Close) ‘Close the result set

con.DisConnect ‘Here disconnect the existing connection

Else

MessageBox (”Could not connect to data source”)

End If

Edit document via its view column entries

It is simple and a very useful when allow user to edit document by caret id of current document through view entries. There is no need opening document in edit mode.

Setp 1:

First Select the columns that will display the editable fields.

Setp 2:

Then choose the design of column properties box and check “Editable column” on the Info tab of the column properties box.

Setp 3:

Goto Inviewedit event in the Programmer’s pane and then type the following coding.

Coding:

Declare and Define constants for request types

Const QUERY_REQUEST = 1 ‘Declare constant for requesting the query to view when user enter the editable column

Const VALIDATE_REQUEST = 2 ‘Validate the current field is editable or not

Const SAVE_REQUEST = 3 ‘Update the editaed values after validation on existing document

Const NEWENTRY_REQUEST = 4 ‘Add enries to new document

‘Declare the neccesscery variables

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String ‘Variable for getting carret id of currently pointing document

caret = Source.CaretNoteID ‘Get the CaretNoteID

If caret = “0″ Then Exit Sub ‘ exit if it does not point at document

Set db = Source.View.Parent

Set doc = db.GetDocumentByID(caret) ‘ Get the current database and document

Select Case Requesttype ‘Here select the type of request

Case VALIDATE_REQUEST ‘Validate when user tries to save document with no value

If Fulltrim(Columnvalue(0)) = “” Then

Messagebox “You must enter a value”,, “No value in column”

Continue = False

End If

Case SAVE_REQUEST ‘Check the save mode

For i = 0 To Ubound(Colprogname) Step 1

Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))

Next

Call doc.Save(True, True, True)

Iterator methods for Java

This is one of the most useful interface in java collection framework. It is similar to vector but it is unsynchronized .

Also it is similar to Enumeration in the Java collections framework. But it differ from enumerations in two ways

Iterators allows the caller to remove elements from the underlying collection during the iteration with well-defined semantics.

There are powerful methods for traversing elements.

Methods:

hasNext()
next()
remove()

Stpes:
1. First, obtain iterator to the start of the collection by calling the collection’s iterator( ) method
2. Then call the hasNext( ) method to find wethear nest item is available or not.
3. Finally, within the loop, obtain each element by calling next( ).

ListIterator

With help of this class traverse the elements in both ways, modify & adding new element in list during iteration, and obtain the iterator’s current position in the list.

Additional methods:

hasPrevious()
previous()
nextIndex()
previousIndex()

Excluding Saturday and Sunday from given two dates

Hi gus, with help of business days you easily find number days between two dates. But x-pages doesn’t support business day. So this is useful by the following java script and @formulas coding:

Step 1: Get the starting and ending date.

Step 2: Find total number of days between this two days

Step 3: Divide the result value in step2 by 7 and then multiply this value by 2

Step :4 Subtract this value from total days

Coding:

var sd=getComponent(”StartDate”).getValue(); // Starting date

var ed=getComponent(”EndDate”).getValue(); //Ending date

var weekdays=0;

var days=@Day(ed)-@Day(sd);

if(@Month(sd)==”1.0″ || @Month(sd)==”3.0″ ||@Month(sd)==”5.0″ ||@Month(sd)==”7.0″ ||@Month(sd)==”8.0″ ||@Month(sd)==”10.0″ ||@Month(sd)==”12.0″)

//To find number days between two give dates

var months=(@Month(ed)-@Month(sd))*31;

if(@Month(sd)==”4.0″ || @Month(sd)==”6.0″ ||@Month(sd)==”9.0″ ||@Month(sd)==”11.0″)

var months=(@Month(ed)-@Month(sd))*30;

if(@Month(sd)==”2.0″)

var months=@Month(sd)*28;

if(@Year(sd)%4==0) //If the give is year is leaf year

var years=(@Year(ed)-@Year(sd))*366;

else //Ordinary Year

var years=(@Year(ed)-@Year(sd))*365;

var tdays=days+months+years+1; //Total days

if(tdays>=7)

weekdays=Math.floor(tdays/7); //Calculate number of weeks

var ds=tdays-(weekdays*2); //number of days excluding Week start and end dates

getComponent(”Duration”).setValue(ds);

Repeat control with Multi values for Field

Hi Guys, i want to share discussion about how to use repeat controls. Here i show small example and use java expression syntax. I got some idea about binding java objects to fields.

Step1: Create a form and give name as Test, Create a editable field inside this form as field.

Step2: Then create a one x-page. Place the one repeat control and button and then place the following code in onclick event of this button and will show the result.

Code:

var field = document.getValue( ‘field’ );
if( !field ){ field = []; }
if( typeof field === ’string’ ){
field = [ field ];
}
field.push(”);
document.setValue( ‘field’, field );

var field = document.getValue( ‘field’ );

if( !field ){ field = []; }

if( typeof field === ’string’ ){

field = [ field ];

}

field.push(”);

document.setValue( ‘field’, field );

Count number of seelcted documents and alter the entries in xpages

Hi here i use current user as search element for getting handle of document. I want to change the leave status as cancelled when those approved documents.
step 1:
First get the handle of the view panel
step 2:
Declare the array varaible for store the ids of selected documents
Step3:
Whit help of loop iterate the document one by one and the replace the new value
Source Code:
var empname=@Name(”[CN]“,context.getUser().getFullName());
var viewPanel=getComponent(”LeaveDetailsPanel”);
var docIDArray=viewPanel.getSelectedIds();
var ALAView:NotesView = database.getView(”vw_NewAnnualLeaveAll”);
var ALADoc:NotesDocument=ALAView.getDocumentByKey(empname);
for(i=0;i < docIDArray.length; i++)
{
var docId=docIDArray[i];
var selectedDoc=database.getDocumentByID(docId);
var Duration=@TextToNumber(doc.getItemValue(”Duration”));
var Balance=LeaveAvailable+Duration;
var status=@Text(doc.getItemValue(”Status”));
if (status==”Approved”)
{
selectedDoc.replaceItemValue(”Approved”,”Cancelled”);
selectedDoc.save();
ALADoc.save();
}
}

Add a new Document using Dojo

Dojo is toolkit for creating dynamic web user interfaces. Here i save new document with help of dojo popup.

Step 1: Select Xpage-> All Properties->Dojo -> Set the values of dojoParseOnLoad and dojoTheme as True.

Step 2: Create server java script and place the following code:

function dialog_create(id, title1) {
var dialogWidget = dijit.byId(id);
if( dialogWidget )
dialogWidget.destroyRecursive(true);
dialogWidget = new dijit.Dialog({
title: title1, duration:600},
dojo.byId(id));
var dialog = dojo.byId(id);
dialog.parentNode.removeChild(dialog);
var form = document.forms[0];
form.appendChild(dialog);
}

function dialog_create(dojoid, Popuptitle) {

var dialogWidget = dijit.byId(dojoid);

if( dialogWidget )

dialogWidget.destroyRecursive(true);

dialogWidget = new dijit.Dialog({

title: Popuptitle, duration:600},

dojo.byId(dojoid));

var dialog = dojo.byId(dojoid);

dialog.parentNode.removeChild(dialog);

var form = document.forms[0];

form.appendChild(dialog);

}

step 3: Select Xpage-> Resources-> Add this create script.

step 4: Within div tag, create the some fields and set id name as “Add” and Create one button for save the document.

step 5: Then On click event of Save button, write the code: dijit.byId(”Add”).show()

step 6: The preview this page in web browser and then see the result.

How to clear a Java Error Using Java code in Notes

ClearJavaError: It is one of the java object for clearing all

error while trying to get a specific java class. The user want

to get all the error informations then all java errors are

cleared with help of this object.

Code:

Dim jclass As JavaClass
Dim jrror As JavaError
On Error GoTo Catch
Set mySession = new JavaSession()
Set jclass = mySession.GetClass(”Invalid”)
exit Sub
Catch:
Set jerror = mySession.getLastJavaError()
MessageBox jerror.errormsg,, “Error”
mySession.ClearJavaError

Dim jclass As JavaClass

Dim jrror As JavaError

On Error GoTo Catch

Set mySession = new JavaSession()

Set jclass = mySession.GetClass(”javaClass”)

exit Sub

Catch:

Set jerror = mySession.getLastJavaError()

MessageBox jerror.errormsg,, “Error”

mySession.ClearJavaError

View Panel - Filtering column

Where i learn this stuff?

I want to display information about current user only. But i

got conflict that is i saw information about all users. At that

time i got idea about filter by column in view panel.

Step1 : Select the view panel->properties->Add Data Source

Step 2: In Data Option, select-> Filetr By Category Name->Click on diamond symbol-Select->Computed value

Setp 3: Then add condition. Here i use current user as the

filtering value. @Name(”[CN]“,context.getUser().getFullName());

Sending NotesDocument Link in Notes and Web

Here i want share about how to send document link to mail by document universal id.

Step 1: Create one document for send mail and add the following necessary fields: Form, From, Memo, SendTo and Subject.

Step 2: Save the data source and then get that universal id of that document

Step 3: finally add this id to body.

var Sender=”Ram Kumar”;

var Receiver=”kramkumar.mca@gmail.com”

var Subject;

var DocUNID = LeaveRequest.getDocument().getUniversalID();

var SendingxPage = “LeaveRequest.xsp”;

mailDoc=database.createDocument();

mailDoc.appendItemValue(”Form”,”Memo”);

mailDoc.appendItemValue(”From”,Sender);

Subject=” To be Approved”;

mailDoc.appendItemValue(”Subject”,Subject);

var rtItem=mailDoc.createRichTextItem(”Body”);

var serverName=session.getServerName();

var DBPath=session.getDatabase();

var dbFullAddressNotes = serverName + “/” + DBPath;

rtItem.appendText (”Hi “+Receiver+”,”)

rtItem.addNewLine(2)

rtItem.addTab (1)

//On Notes var url=”notes://”+dbFullAddressNotes+”/”+LRxPage+ “?OpenXPage&documentId=”+DocUNID+ “&action=editDocument”;

//On Web Browser var weburl=”http://”+ serverName +”.maargasystems.local”+”/”+DBPath+” /”+SendingXPage+ “?OpenXPage&documentId=”+LRUNID+ “&action=editDocument”;

rtItem.appendText(” Please click on the below link to approve my request:”)

rtItem.addNewLine(1)

rtItem.appendText(”On Notes: “+url)

rtItem.addNewLine(1)

rtItem.appendText(”On Browser “+weburl)

rtItem.update()

mailDoc.appendItemValue(”SendTo”,Receiver);

mailDoc.send(false)

Java File Reader and File Writer

Here i want to discuss about how to read data from a file and

to append that content to another file by java program. Here

i use FileReader class for reading content from file and FileWriter

for append data to file. Also BufferedReader class is used to

getting input from keyboard at run time.

Coding:

import java.io.*;

public class DemoFileCreation{

public static void main(String[] args) throws IOException {

FileReader inputStream = null;

FileWriter outputStream = null;

BufferedReader dataIn = new BufferedReader( new InputStreamReader(System.in) );

System.out.println(”Enter Roll No:”);

String sno=dataIn.readLine();

System.out.println(”Enter Name:”);

String name=dataIn.readLine();

try {

File f=new File(”demo.txt”);

if(!f.exists())

{

f.createNewFile();

}

inputStream = new FileReader(f);

outputStream = new FileWriter(”characteroutput.doc”,true);

outputStream.write(”\n”);

outputStream.write(”Roll No: “+sno);

outputStream.write(”\tName: “+name);

}

finally {

if (inputStream != null) {

inputStream.close();

}

if (outputStream != null) {

outputStream.close();

}

}

}

}

User Defined Data types in Lotus Script [Like Structure]

In lotus script, types is collection more than one data variables that can be manipulated as a single unit.

It is similar to structure in c and used to store database records within LotusScript.

These members are declared without Dim keyword.

Here i describing how to create type and use by the below example:

——————————————-

TYPE Data1

EmpID As number

EmpName As STRING

Doj As DateTime

END TYPE

——————————————–

Now the following declaration descrips how to use members of Data1 by (.) operator

Dim employee as Data1

emploee.EmpId=7615

employee.EmpName=”Ram”

employee.Doj=”08/11/2010″

Listbox Elements manipulation [Move Up and Down]

Here i want to share about how to move items in list box by up and down direction.

Setp 1:

Create one script library as java script and add the following function

function move(item,direction)

{

var listbox = item;

var direction=direction;

var selIndex = listbox.selectedIndex;

if(-1 == selIndex) {

alert(”Please select an option to move.”);

return;

}

var increment = -1;

if(direction == ‘up’)

increment = -1;

else

increment = 1;

if((selIndex + increment) < 0 ||

(selIndex + increment) > (listbox.options.length-1)) {

return;

}

var selValue = listbox.options[selIndex].value;

var selText = listbox.options[selIndex].text;

listbox.options[selIndex].value = listbox.options[selIndex + increment].value

listbox.options[selIndex].text = listbox.options[selIndex + increment].text

listbox.options[selIndex + increment].value = selValue;

listbox.options[selIndex + increment].text = selText;

listbox.selectedIndex = selIndex + increment;

}

step 2:

Create new xpage ->Select Page->Properties-> In resource, add the java script.

Step 3:

Then place one list box and add some values and two buttons and call this function as

In Up button,

var listbox = document.getElementById(”#{id:list}”);

var direction=”up”;

move(listbox,direction);

In Down Button,

var listbox = document.getElementById(”#{id:list}”);

var direction=”down”;

move(listbox,direction);

Step 3:

Then preview this xpage and show the result.

Dojo Tooltip

This is one of the feature of dojo and simple. It is similar to help button and used to design the web pages attractively.

Step 1 : Create one xpage and add some control to that page.

Here i use one button for testing purpose.

Step 2: Add the dijit.Tooltip module in Xpage Resources.

Step 3: Then select source and the following tag within tag. Here label give the information about that control.

“This is a button”>

Launching application via Lotus Script

Start new process or application from notes client

In lotus script, by calling the Shell(”processname”) method.

Syntax:

Shell ( processName[ , windowStyle ] )

Example:

Dim i As Integer
i=Shell(”calc.exe”)

Dim i As Integer

i=Shell(”calc.exe”)

———————————————————————————————–

In formula, by calling execute command

Syntax:

@Command( [Execute] ; application ; fileNames )

Example:

@Command( [Execute];”Admin”)

JUNIT testing

JUNIT testing is a unit testing framework for java Programming Language. Which is one of the family of unit testing frameworks collectively known as xUnit and organized with sUnit.

Unit test = “Individual unit of Testing”.

xUnit : Various code-driven testing frameworks have come to be known collectively as xUnit. These frameworks allow testing of different elements (units) of software, such as functions and classes. The main advantage of xUnit frameworks is that they provide an automated solution with no need to write the same tests many times, and no need to remember what should be the result of each test.

Code Driven Testing : It checks the Expected output comes or not for all modules.

SUnit : SUnit is a unit testing framework for the programming language Smalltalk.

Small Talk : Smalltalk is an object-oriented, dynamically typed, reflective programming language.

JUnit Testing Example:

* Write Class for testing

* Testcase

* Test Suite

Example:

Class{

§public class TestClass {

public static int testfunction(int a,int b){

return(a+b); }

public static void main(String[] as){

TestClass1 obj=new TestClass1();

System.out.print(obj.testfunction(2,3));

}

}

Test case:

§Test case class should starts with test and should be the subclass testCase class.

public class TestClass1Test extends TestCase {

§

protected void setUp() throws Exception {

super.setUp();

}

protected void tearDown() throws Exception {

super.tearDown();

}

public void testTestfunction() {

int c=TestClass1.testfunction(5, 3);

assertEquals("Test Fails",8,c);

}

}

TestSuite:

§public class AllTests { §

public static Test suite() {

TestSuite suite = new TestSuite(AllTests.class.getName());

//$JUnit-BEGIN$

suite.addTestSuite(TestClass1Test.class);

//$JUnit-END$

return suite;

}

}

Batch file Creation

Batch file creation is nothing but the action which is done in MS-DOS

Example :
Running a java file...
//********************************
e:
cd javap
javac
javac hello.java
java hello
//****************************************
SVAE IT AS .bat extension

How to stop a running thread

Example for stopping the Running thread in simple java Coding

public class ThreadStop extends Thread {
private boolean running = true;
public void run() {
while (running) {
System.out.print(".");
System.out.flush();
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {}
}
System.out.println("Shutting down thread");
}
public void shutdown() {
running = false;
}
public static void main(String[] args)
throws InterruptedException {
ThreadStop t = new ThreadStop();
t.start();
Thread.sleep(5000);
t.shutdown();
}
}

XSLT and XML

XSLT is a specialized programming language for transforming XML documents. Even though it is part of XSLand as such intended to be used for transforming XMLdocuments into XSL-FO for presentation purposes...
Fro example :

XML Data :

<?xml-version = "1.0" ?>
<?xml-stylesheet type="text/xsl" href="samplexslt.xsl"?>
<sample>
<a>
<Name>Ramkumar</Name>
<age>23</age>
<occupation>SE</occupation>
</a>
<a>
<Name>Ramya</Name>
<age>21</age>
<occupation>SE</occupation>
</a>
<a>
<Name>Mahe</Name>
<age>21</age>
<occupation>SE</occupation>
</a>
</sample>

XSLT example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>XSLT test</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Age</th>
<th>Occupation</th>
</tr>
<xsl:for-each select="sample\a">
<tr>
<td><xsl:value-of select="age"/></td>
<xsl:choose>
<xsl:when test="age &gt; 21">
<td bgcolor="#ff00ff">
<xsl:value-of select="Name"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="Name"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

XSL,XSLT,XSL-FO and XML

Xsl:

(eXtensible Stylesheet Language) A style sheet standard from the W3C that is used to convert an XML document into many formats for publishing and printing. XSL is similar to the Cascading Style Sheets (CSS) in HTML and is compatible with CSS2. An XML document is converted by an "XSLT Processor," also called an "XSLT Transformation Engine," into the new format based on three sets of XSL description languages, as follows:


XSL-FO - Convert to Page Formats
The XSL Formatting Objects (XSL-FO) language is used to apply page formatting to an XML document and produce an XSL-FO document. The resulting XSL-FO file, or simply "FO file," serves as a paginated master file for conversion to page-oriented formats such as PDF, PostScript, AFP or PCL. The conversion is handled by a third-party program such as XML Engine for Print (XEP) from RenderX (www.renderx.com) or Apache Formatting Objects Processor (http://xmlgraphics.apache.org/fop).

When a user selects a PDF document on a Web page, the file may actually reside in XSL-FO format and be rendered on the fly to PDF for that user in real time. The XSL-FO format was designed to outlive proprietary page description languages and is a good choice for archiving paginated documents.

XSLT - Convert to XML, HTML and Text
The XSL Transformation Language (XSLT) is used to convert an XML document into an HTML or text document or to another XML document with a different structure. The most common XSLT transformations are from XML to HTML for rendering in a Web browser. Unlike the paginated format of XSL-FO, HTML pages are structured as scrollable windows of infinite vertical length.

If the XSLT to transform XML to HTML is embedded in an XML document, the document can be converted to HTML on the fly for rendering, just as XSL-FO can be turned into PDF on the fly for downloading.

Xpath - Select and Calculate
The XML Path Language (Xpath) is used in conjunction with XSL-FO and XSLT to select elements within an XML document. Xpath can also be used to count items; for example, how many times a particular tag occurs in the document. See xquery, xml and css

Validation for Text field

In Xpage, If we want to validate the Text filed, e have two choice...

1. Use of Xpage properties, We can validate

2. Use of java Script.,

In first one, We have one contradiction for validating the fields. If you want to move the page to home page, the validation does not allow you to go the Home page.

So the best way to validate the field is javaScript...
In @formula we have the @match for exact validation of fileds. Samething is here in java script is regular expression...

For Ex:

Text Field Validation:

var name=document.getElementById("#{id:inputText1}").value;
var patt=/([a-z][A-Z])/i;
var num=/([0-9])/i;
var numflag=name.match(num);
alert(numflag);
var flag=name.match(patt);
var len=name.length;
if(len==0)
{
alert("Enter the Name");
exit(0);
}
else if((flag==null) || (numflag!=null))
{
alert("Enter the Propername");
exit(0);
}
alert("Correct Value");



Exit sub for @formula is @return

Basically We confused for many times because handling the @formula...

When we are executing the @if commands there will some problem we will get ...

@if(
@isnull(fieldName)
@prompt(1;"Alert";"Field is Null");
@prompt(1;"Alert";"Field is Not Null")
);
@prompt(1;"";"Here will be executed when the @if command finished");
.................
.................
.................

After executing the @if condition, @formulas never bother about condition falls True or False. It continues the execution...

Here we can handle the situation using @return command.

Example:

@if(
@isnull(fieldName)
@return(@prompt(1;"Alert";"Field is Null"));
@prompt(1;"Alert";"Field is Not Null")
);
@prompt(1;"";"Here will be executed when the @if command finished");
.................
.................
.................

Here If the Validation returns "Field is Null", It does not continues the execution...

Invalid and nonexistent document "IBM ERROR"

I got a Problem While transferring document from one to another....

[Best way to Recover "Copy All your form Contents and Paste it to Another form..."]

Their i used @mailsend(;;;;;;;"[IncludeDoclink]);

But the IBM Error Occurs "Invalid and nonexistent document"

After that I try to preview my corresponding( to that Document) Notes form...

Similar Error was thrown...

I think that We have No option...

There are some Option i found in NET but that as not working in my PC (Notes 8.5.2)

1. In server Your db may corrupt so only that Error Came, you type the following in Server

>LOAD FIXUP filename


2. Clear Cache.NDK in notes data Directory... and It may be Run....

3. Reinstall notes After taking Backup

4. I did Copyall the corresponding form and Renamed. Make a new form as same name as old.. And i pasted Every thing.. their I have lost Some data Not All....

"Lotus Script" How to Put Values In Combo box

Step 1:

First, In my Knowledge there is no direct way for this Task. Make a field as hidden.

Step 2:

Get the values Dynamically, And put it in our hidden field using FieldAppendText with seperator "," .

Step 3:

After that, Using Combo box formula window Write a single line code as follow

"@Explode(HiddenFieldName;";")

Step 4:

Never forget one thing that is to check the property given Below...

Lotus Script code:

Dim ws As New
NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set
uidoc=ws.currentdocument
Dim ns As New NotesSession
Dim db As
NotesDatabase
Dim doc As notesdocument
Dim vw As
notesview
Dim vc As NotesViewEntry
Dim vec As
NotesViewEntryCollection
Set db=ns.CurrentDatabase
Set
vw=db.GetView("vwName")
Dim ab As
Variant
Dim str1 As String
ab=vw.GetColumnValues(0)
Forall
a In vw.GetColumnValues(0)
If str1=""
Then
str1=a
Else
str1=str1+","+a
End
If
End
Forall
Call uidoc.FieldSetText("test",str1)
Call
uidoc.Refresh

To view the Design Elements In Our Own View

%Rem

If we want to view our Documents is Possible in Lotus Notes

But If we want to view the Design Elements Like Forms , Views, Folders, Agents, Script -

Libaraies and Etc.,

Blindly Someone says "NO"

But It is Possible...

By

LOTUS NOTES "$FLAGS" AND "$FORMULA CLASS" Reserve Fields

End %Rem


Step : 1

'Agent Code In Initialize

Sub Initialize()
Dim ns As New
NotesSession
Dim db As NotesDatabase
Dim vw As
NotesView
Dim doc As NotesDocument
Dim a As
Integer
Set db=ns.currentdatabase
Set
vw=db.Getview("ViewName")
Set
doc=db.Getdocumentbyunid(vw.Universalid)
Call
doc.Replaceitemvalue("$FormulaClass","1548")
doc.save
True,True
End Sub

Step :2

' And We Have some Hidden Fields In All Design Elements

' We Have To Create Two Columns in our View,

' Use The Following Code in our First Column

'Column Name : Type

@If(
@Contains($Flags;"W");"Pages";
@Contains($Flags;"Y");"Views";
@Contains($Flags;"F");"Folders";
@contains($Flags;"");"Forms";
"Others"
)

' And In Second Column You Put Default Value As $Title

'Displays the Forms, Pages , view and Other Design Elements

Step :3

* Run the View,

* Select the some Documents that May be "HIDDEN"

* And Run the Agent

* Press Shift + F9

* You will See, What U want...
For More Information goto
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/view-of-design-elements.htm

Dbcolumn for LotusScript

We have a very easy method to get the column values of our view(@dbcolumn).

getcolumnvalues(0) - Returns First column Values
getcolumnvalues(1) - Returns Second column Values

Like C array...

Code:

Dim session As
New notessession
Dim db As NotesDatabase
Dim vw As
notesview
Set db=session.CurrentDatabase
Set
vw=db.GetView("VwName")
Forall a In
vw.GetColumnValues(0)
Msgbox a
'similarly we can get Dbcolumn
End Forall

The Above code
displays the First column values...

How to generate the PDF using javaagent

Here I have four field in an document...

I have known that field's name...

I can generate the PDF document using pdfWriter class in java...

The below javaAgent is used to generate the PDF document in our given location.


public class JavaAgent extends AgentBase
{
public void NotesMain()
{
try
{
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Document docpdf = new Document();
Database db=session.getCurrentDatabase();
View vw=db.getView("vw_employeeDatails");
try
{
//create a document
PdfWriter.getInstance(docpdf, new FileOutputStream("E:\\New Folder\\CreatePDFInlotus.pdf"));
//open doc for r/w
int i=1;
docpdf.open();
while(doc!=null)
{
String testName=doc.getItemValueString("name");
String dept=doc.getItemValueString("department");
String des=doc.getItemValueString("designation");
Vector mob=doc.getItemValue("mobno");
String mobn=mob.toString();
docpdf.add(new Paragraph ("\n"));
docpdf.add(new Paragraph ("Value : "+i));
docpdf.add(new Paragraph (testName));
docpdf.add(new Paragraph (dept));
docpdf.add(new Paragraph (des));
docpdf.add(new Paragraph (mobn));
i++;
doc=vw.getNextDocument(doc);
}
// Code updated
}
catch (DocumentException de)
{
System.err.println(de.getMessage());
}
docpdf.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}