Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Select server / directory

Posted on 2002-05-28
14
Medium Priority
?
358 Views
Last Modified: 2013-12-18
Hi all,

I created an agent that creates a new database. Now I'd like the user to select the destination of the database him/herself. So I need something that lists down all servers and directory on it but NOT the files.
Basicly I need the same pop-up as notes has when you select create new database. Formula or script I dont care.

@Prompt([ChooseDatabase]; "";"3") Wont work. because it shows the files as well.
0
Comment
Question by:jvanhalderen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
14 Comments
 
LVL 10

Expert Comment

by:zvonko
ID: 7039929
Is my assumption right: Notes client users, R5?

Any of the users has to be allowed to create databases on these servers. Are you aware of this? Most installation forbids such actions without Administrators.

On web it is no problem...



 
0
 
LVL 10

Accepted Solution

by:
zvonko earned 2000 total points
ID: 7040184
Hello,

here is my proposal.

I assume it has to run on Notes client.
I assume you want to have a button on a form (it is not a problem to transform to an action or an agent).
On this form there are also two text fields: ServerName and DatabasePath

Clicking on the button should allow selection of one of available servers (if field ServerName is empty). If then a server is selected a path list is assembled and a path can  be select from the list.

The code for this button is as follow:
Option Declare
Declare Function OSLockObject& Lib "nnotes" (Byval nHandle%)
Declare Function OSUnlockObject% Lib "nnotes" (Byval nHandle%)
Declare Function OSMemFree% Lib "nnotes" (Byval nHandle%)
Const OS_TRANSLATE_LMBCS_TO_NATIVE = 1
Const MAX_SERVER_NAME = 256
Declare Function NSGetServerList% Lib "nnotes" (Byval dwPortName&, nRetServerTextList%)
Declare Function ListGetText% Lib "nnotes" (Byval dwList&, Byval nPrefixDataType%, Byval nEntryNumber%, dwRetTextPointer&, nRetTextLength%)
Declare Function OSTranslate% Lib "nnotes" (Byval nTranslateMode%, Byval dwIn&, Byval nLength%, Byval lpszOut$, Byval nOutLength%)

Sub Click(Source As Button)
  Dim ws As New NotesUIWorkspace
  Dim uidoc As NotesUIDocument
  Dim ServerName As String
  Dim DatabasePath As String
 
  Set uidoc = ws.CurrentDocument
  ServerName = Trim$(uidoc.FieldGetText("ServerName"))
  If (ServerName = "") Then
    ServerName=GetServerName()
  End If
  If (ServerName = "") Then Exit Sub
  Call uidoc.FieldSetText("ServerName", ServerName)
 
  Dim session As New notessession
  Dim db As notesdatabase
  Dim dbdir As New NotesDbDirectory(ServerName)
  Dim path As String
  Dim ServerPaths() As String
  Dim isFound As Integer
  Set db = dbdir.GetFirstDatabase(DATABASE)
  Redim ServerPaths(0)
  While Not db Is Nothing
    path = Strleftback(db.filepath, "\")
    isFound = False
    Forall paths In ServerPaths
      If path = paths Then isFound = True
    End Forall
    If Not isFound Then
      Redim Preserve ServerPaths(Ubound(ServerPaths)+1)
      ServerPaths(Ubound(ServerPaths)-1) = path
    End If
    Set db = dbdir.GetnextDatabase
  Wend
  Redim Preserve ServerPaths(Ubound(ServerPaths)-1)
  DatabasePath = ws.Prompt(PROMPT_OKCANCELLIST, "Select Database Path", "Select one Database Path from the list.", "", ServerPaths)  
  If (DatabasePath <> "") Then Call uidoc.FieldSetText("DatabasePath", DatabasePath)
End Sub

Function GetServerName() As Variant
  Dim ws As New NotesUIWorkspace
  Dim ServerName As NotesName
  Dim lpszServer$
  Dim szArray() As String
  Dim hList%, nStatus%, nCount%, nLength%
  Dim dwList&, dwHold&
  nStatus%=NSGetServerList(0, hList%)
  If nStatus%=0 And hList% <> 0 Then
    Redim szArray(0)
    dwList&=OSLockObject(hList%)
    Do While nStatus%=0
      nStatus%=ListGetText(dwList&, 0, nCount%, dwHold&, nLength%)
      If nStatus%=0 And nLength%>0 Then
        lpszServer$=Space$(nLength%)
        Call OSTranslate(OS_TRANSLATE_LMBCS_TO_NATIVE, dwHold&, nLength%, lpszServer$, MAX_SERVER_NAME)
        Redim Preserve szArray(nCount)
        Set ServerName = New NotesName ( lpszServer$ )
        szArray(nCount)= ServerName.Abbreviated
      End If
      nCount=nCount+1
    Loop
    Call OSUnlockObject(hList%)
    Call OSMemFree(hList%)
  End If
  If Ubound(szArray) > 0 Then
    GetServerName = ws.Prompt(PROMPT_OKCANCELLIST, "Select Server", "Select one server from the list.", szArray(0), szArray)  
  End If
End Function

Good luck,
Zvonko


0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7040213
Well, Cant you use the Directory's view of the servers and show in the promptlist ???

I am just curious....

To get the current server use the @Subset(@DbName ; 1)
You know the db name "names.nsf"
You will know the servers view is "Servers"
The column is 3

Why dont you do a @dbcolumn with all the parameters to get a list of all servers names and show it using an @Prompt list function ???

I am just curious.....

:-)
Arun.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:zvonko
ID: 7040230
Ok, and then... ???

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7040275
uh Oh !

I thought he needs only the servers. Now i got the whole point.

Hee Hee Hee !

Hold on guys i think we have an application running here. Let me c&p the code here !

;-)
Arun.
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7040772
Hello jvanhalderen,

from the history of your answered questions I see that you often give a B or even worse a C grading! This is not good.

The grading is not school grading; it is expert points multiplication factor.

So please give an A+ for my efforts. Thanks :-)

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7040796
You Beggar !

You Cheat !

You Bro !

I Like your approach anyways.... hee hee hee!

;-)
Arun
PS: Our app is completely different, this prompts to key in the directory...hmmmm....you win !
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7040809
Good night Bro <|:-)

0
 
LVL 10

Expert Comment

by:zvonko
ID: 7041435
Hello jvanhalderen,

if you have any questions about my code then ask them now.

I go sailing on Friday :-)

And please do not be so thrifty with your comments :)

If you do not like to write it in English then feel free to write to me in German, Bavarian, Serbo-Croatian, Macedonian or in Dutch to: paunoski@freenet.de

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7041440
Oh boy you are for a biggie...2k for sure huh ?  Enjoy buddy !

:-)
Arun.
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7041584
I hope so :)

This vacations will move a lot of points from me to you :)

0
 

Author Comment

by:jvanhalderen
ID: 7041680
A++

RESPECT!! thnx a lot
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7042074
That was an awesome grade for my Bro...

Thanks Jvanhalderen !  Few more like this to my buddy he will be on top of me ! Right Zvo ?

:-)
Arun.
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7042183
Yeapy!!!

Thanks jvanhalderen, for the points and for the feedback :-)



0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 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