Solved

How to get the Data type of a field in Agent?

Posted on 2004-09-20
10
256 Views
Last Modified: 2013-12-18
My agent runs on selected documents.In my agent I prompt the user to select any of the field name listed. When the user selects the field name I want to check for the data type of that field in the document. How can I do that?

My code :

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim item As NotesItem
Dim doc As NotesDocument
Dim chkField As Variant
Dim result As Variant
Dim strField As Variant
Dim strValue As Variant
Dim values(25) As String
values[0]="status"
values[1]="documentdet"
values[2]="Form"
.
.
strField = workspace.Prompt(PROMPT_OKCANCELLIST, "SetProcessingField", "Choose the Field Name:","",values)
If strField <> "" Then
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
For i = 1 To collection.count
Set doc = collection.GetNthDocument(i)
Set chkField=doc.GetFirstItem(strField)

"How do I check for the data type of the field here?"
Next
End If


Thanks in advance,
Abby
0
Comment
Question by:AboutLotus
  • 5
  • 5
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12100629
So far so good. You've got the NotesItem in ChkField. Did you look in the Designer Help db, under NotesItem? It says that there is a Type property. Will that do?
0
 

Author Comment

by:AboutLotus
ID: 12100693
Yup I saw the type property but if it is a date field then it still gives string. Can't I get that data type too?
0
 

Author Comment

by:AboutLotus
ID: 12100711
Because I how to check the data type if it is  a numeric/string/date and then choose the related functions on that. How can I do that?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12100738
Look at all the IsXXXX functions, like IsDate. To make sure that you have a real date when using the field, always use CDat.

There is also the DataType function, it returns the type of an expression and not of the field itself. It might help you anyway. See also the TypeName function, but it's not one of my favourites.
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 20 total points
ID: 12100760
Are you sure that the field really is a Date field, if you say it says it is a String?? Look in the Document Properties box, maybe it just IS a String...
0
 

Author Comment

by:AboutLotus
ID: 12100852
I have proceeded like this

Dim itemType as Integer

itemType =item.type                  

If (itemType =768 ) Then
chkValue =workspace.Prompt(PROMPT_OKCANCELEDIT, "SetProcessingField", "Enter the Field Value in Number Format", )
strValue=Cint(chkValue)

Else

 If(itemType =1280) Then

"here I have to check if it is a date field"
 chkValue =workspace.Prompt(PROMPT_OKCANCELEDIT, "SetProcessingField", "Enter the Field Value in Date Format", )
strValue=Cdat(chkValue)

 Else

 strValue =workspace.Prompt(PROMPT_OKCANCELEDIT, "SetProcessingField", "Enter the Field Value in String Format", )
                  
End If
End If
                  
Next
End If


Please help me with this.
0
 

Author Comment

by:AboutLotus
ID: 12100916
Hey Thanks Sjef!!!!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12101857
You cracked it! Great.

Normally, You give a grade B when the answer is right but doesn't exactly make you happy. Is that so? Don't worry for this question, no hard feelings! But please read the EE-guidelines...
0
 

Author Comment

by:AboutLotus
ID: 12102223
Hey its not like that. I am new to this forum. I am really happy with ur answer. Sorry for the mistake I have done. Anyhow Thanks Sjef.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12104336
:) I knew you're knew ;)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 41 208
Permanent Lotus Notes Connection for all users in a Domino Domain 15 109
@Mailsend 3 66
Lotus Notes want to capture date/time FIRST time a field changes status 7 75
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question