Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
ContextItems
zephyr2000
Hi. I am developing with WorkSite 8.0. I need to pop-up a selection dialog of users, classes, etc.
Running the code below, I get the WorkSite selection dialog appearing but get an error message
"Could not get database(s) collection".
I get the feeling I'm missing a context item somewhere - could somebody please point out what I'm doing wrong?
Dim objDMS As New IManage.NRTDMS
Dim objSession As IManage.NRTSession
Dim objContext As New IMANEXTLib.ContextItems
Dim objAuthor As New AuthorLookupCmd
Dim arrSessions(0) As NRTSession
Dim arrDBs(0) As NRTDatabase
Set objSession = objDMS.Sessions.Add("PC0063")
objSession.TrustedLogin
objContext.Add "NRTDMS", objDMS
Set arrSessions(0) = objSession
objContext.Add "SelectedNRTSessions", arrSessions
objAuthor.Initialize objContext
objAuthor.Update
objAuthor.Execute
Thanks
Chris
Find more posts tagged with
Comments
shirinp
Hi, I was encountering this same problem... did you ever figure it out?
Thanks
zephyr2000
Yes I did figure it out, eventually
Here's the code:
--- START CODE
Dim objContext As Object, objLookup As Object
Set objContext = CreateObject("iManExt.ContextItems")
' Decide on which lookup dialog to open
Select Case iSelector
Case 5
Set objLookup = CreateObject("iManExt.AuthorLookupCmd")
Case 6
Set objLookup = CreateObject("iManExt.OperatorLookupCmd")
Case 7
Set objLookup = CreateObject("iManExt.TypeLookupCmd")
Case 8
Set objLookup = CreateObject("iManExt.ClassLookupCmd")
End Select
' Set the DMS object and databases collection for the lookup dialog
objContext.Add "NRTDMS", gobjDMS
objContext.Add "IManExt.SelectionDlg.Object", gobjSession.Databases
' Initialize the dialog
objLookup.Initialize objContext
objLookup.Update
' If status is zero, then the dialog is available to use
If objLookup.Status = 0 Then
' Show the dialog
objLookup.Execute
' If the number of items in the returned Context object is greater than
' three, then the user selected a value from the dialog
If objLookup.context.Count > 3 Then
If objLookup.context("IManExt.SelectedString") <> "" Then
' Update the grid on screen with the value the user selected
mfgRequired.TextMatrix(mfgRequired.Row, REQD_VALUE_COL) = objLookup.context("IManExt.SelectedString")
End If
End If
End If
---- END CODE
Hope this helps!
shirinp
Great, thanks so much! I couldnt determine what string to pass in for the database.
By any chance, do you know how to search for custom2 and custom30, depending on the value that was supplied for custom1 and custom29? I am not sure what string to pass into the context item. I am having the same issue with SubClassLookupCmd, because I do not know what string to pass into for the class...
Any ideas on how to do this or where I can find the list of contextitems strings?
Thanks!
jny
The IManExt.CallingObject returns the current dialog object, i.e., NewProfileDlg, NewVersionDlg, EditProfileDlg, etc. Once you have a handle to the dialog object, you may then query for the value of the field you want using the GetAttributeByID(nrAttributeID) Method. Like so:
[VB]
' Set a pointer to your current profile dialog by using the IManExt.CallingObject ContextItem
Dim objCallingDialog As Object
Set objCallingDialog = mContext("IManExt.CallingObject")
' Get the current value of Custom29 field
Dim strRet As String
strRet = objCallingDialog.GetAttributeByID(nrCustom29)
shirinp
Well, I'm not using those dlgs... I'm using the lookupCmd's... can I not use those for this purpose?
When I try:
pContextItems->Item("IManExt.CallingObject");
I get an invalid argument error. Do you know how I can retrieve the custom30/custom2/subclasses specific to their parent items using lookupCmd2/30 ?
Thanks!