Hello,
I am trying to create a config form where I will be able to choose a company name from a dialog list. The only thing is i would like to access the company names from another database and not sure what the formula is to achieve this.
Can anyone provide me with some examples?
Cheers,
Gem
Subject: New-be! Dialog List & Connecting to another database
how are the company names stored in your source database?
If each company is stored in a document and displayed in a view, you can use @dbcolumn. (lookup @dbcolumn in Designer help)
If company names are stored in a single field, you should use lotusscript to get db and document(s) that contain the information.
Subject: RE: New-be! Dialog List & Connecting to another database
Hi Basir,
There stored in a single field.
I have written some script basically using a prompt dialog instead to get the users to select an option…
What I am trying to achieve is - when a user needs to create a task list a prompt dialog will apear asking them to choose a company name. Based on this selection i would like to pull the company information from the other database and have displayed in the form that will pull the task list tasks in for the users to view.
So far i have got the tasklists to appear…but im struggling to pull the information from the other database and was wondering whether you could help me with my lotusscript as im new to this.
Am I going in the right direction???
Sub Postopen(Source As Notesuidocument)
If source.IsNewDoc Then
Dim ws As New NotesUIWorkspace
Dim s As New notessession
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Dim view As NotesView
Set view = db.GetView("va_di")
Dim divisionList As Variant
divisionList = Evaluate(|@Unique(@DbColumn("Notes":"Nocache";"Domapps1/WokingKings";"IT\TrakSyst.nsf";1))|)
divListVal = ws.Prompt(4, "select an organisation to create a task list for...","",divisionList)
Call source.FieldSetText("tasklistname", divListval)
Dim documentcollection As NotesDocumentCollection
Set documentcollection = view.GetAllDocumentsByKey(divListVal,True)
Dim tasktemplatedoc As NotesDocument
Set tasktemplatedoc = documentcollection.GetFirstDocument
While Not(tasktemplatedoc Is Nothing)
Dim newtaskdoc As New NotesDocument(db)
With newtaskdoc
.form = "fa_t"
.taskname = tasktemplatedoc.taskname(0)
.TaskCategory = tasktemplatedoc.TaskCategory(0)
.tasklistunid = source.document.universalID
.status = "Not Complete"
.assignedto = s.UserNameList(0).abbreviated
End With
Call newtaskdoc.MakeResponse(source.Document)
Call newtaskdoc.Save(True,True, False)
Set tasktemplatedoc = documentcollection.GetNextDocument(tasktemplatedoc)
Wend
Call source.refresh
End If
End Sub
Thanks
Subject: RE: New-be! Dialog List & Connecting to another database
Gem, you haven’t put comments on your code where you have problem but here is my comment based on my assumptions:
Set documentcollection = view.GetAllDocumentsByKey(divListVal,True) 'I suppose this is where you want to get list of company-related documents from the external database. But the view you are using is a view in the current database. You need to declare the external database and a view from this database to retrieve the information from.
I hope this makes sense
Subject: RE: New-be! Dialog List & Connecting to another database
Hi Basir,
Thank you for having a look.
I think I sort of get what you mean.
I just have one question and I apologise if this sounds really stupid but, how would a declare a view from an external database.
I am sorry, I am trying to pick things up as quickly as possible.
Thanks,
Gem
Subject: RE: New-be! Dialog List & Connecting to another database
No worries Gem. Will be glad to help.
Suppose your external database is: IT\TrakSyst.nsf
and you have a view the contains the documents you want to get. The first column of the view should display company names and be sorted or categorized. (no second categorized column in the view) and the view name is: myView
'get the external database:
Dim dbExternal As NotesDatabase
Set dbExternal = s.GetDatabase("Domapps1/WokingKings","IT\TrakSyst.nsf" )
'get the external view
Dim viewExternal As NotesView
Set viewExternal = dbExternal.GetView("myView")
'now get your documents from here
Dim documentcollection As NotesDocumentCollection
Set documentcollection = viewExternal.GetAllDocumentsByKey(divListVal,True)
Subject: RE: New-be! Dialog List & Connecting to another database
Hey
Thanks- useful help