The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Error while calling lookup with Do Invoke but without function
Posted: 13 Sep 13 6:42 AM
|
fiogf49gjkf0d Hi,
I am using below code:
Sub NewLookupClick(Sender)
On Error Resume Next
Dim strLookup
Dim blnUseFunction
strLookup = ""
blnUseFunction = False
strLookup = "GC_ACCOUNT_Z:DataPool:DataPool"
If strLookup <> "" Then
If blnUseFunction Then
Application.BasicFunctions.DoInvoke "Function", "Lookup:" & strLookup 'DNL
Else
Application.BasicFunctions.DoInvoke "Lookup", strLookup 'DNL
End If
ErrorCheck Application.Translator.Localize("Error accessing SalesLogix VBScript functions:")
End If 'if strLookup <> ""
End Sub
It is not rasing any error, but how could I get result (ID)?
Also how could I recognise group creation?
Appreciating your efforts,
  ankaj |
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 13 Sep 13 11:14 AM
|
I could be mistaken, but invoking a Lookup this way would set the System's Current Record to whatever the result is.
This is similar to using the Entries on the Lookup Menu.
Now, if you are trying to open a Lookup from a Control on a Form the you should be able to invoke it via the Controls's Methods, and then the result value would be included on the Lookup Properties as well.
|
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 08 Oct 13 1:05 AM
|
Hello,
We are using below function to invoke lookup and get result.
But this will not show option for creating temporary group automatically.
Function LookupByName (strLookupName, strPreFill) Dim objLookup
On Error Resume Next Set objLookup = Application.BASICFunctions.LookupItemWithConditionByID (strLookupName, False, "", "", "", strPreFill) If ErrorCheck (Application.Translator.Localize("Error executing Lookup:")) > 0 Then Exit Function
If Not (objLookup Is Nothing) Then LookupByName = objLookup.ID Set objLookup = Nothing Else LookupByName = -1 End If On Error Goto 0 End Function
Instead we are using below code as suggested,
Application.BasicFunctions.DoInvoke "Lookup", " & strLookup & "
It will be nice if anyone suggested how to write a call using this method,
and to get result returned by Lookup / Group ID created by lookup.
Appreciating your efforts in advance.
Pankaj |
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 08 Oct 13 3:27 AM
|
fiogf49gjkf0d That will work (it's what SLX uses in the Acc/Con Detail screens):
Application.BasicFunctions.DoInvoke "Lookup", " & strLookup & "
Where strLookup takes format of
strLookup = "Account:Account.Account Name"
Provided that the lookup itself (account name for example) is set to be an ID return (not text). |
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 08 Oct 13 3:41 AM
|
fiogf49gjkf0d Hello Mike,
Many Thanks for your views.
If a lookup is on table GC_ACCOUNT_Z for field DataPool and having name DataPool
then strLookup will be TableName & ":" & TableName & "." & FieldName & <space> & LookupName
Is it right?
Because it is doing nothing for below code
Application.BasicFunctions.DoInvoke "Lookup", "GC_Contact_Z.GC_Contact_Z:DataPool DataPool"
Please advise.
Appreciating your efforts in advance.
Pankaj
|
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 08 Oct 13 3:52 AM
|
You firstly need to create a lookup, using Lookup Manager in Admin/Architect. This defines the lookup. You give it a name/caption. You then specify the item found in Lookup Name in the lookup itself.
So, if the lookup is named "DataPool" then the lookup is called via:
"lookup","Account:DataPool"
So, you cannot lookup anything unless it's pre-defined/created (via LookupMgr). Once it's created, you will have given it a unique name (stored in Lookup Name). You then use this in the function to lookup by its name.
|
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 09 Oct 13 6:00 AM
|
fiogf49gjkf0d Hello Mike,
Many Thanks for your views.
I applied the same.
strLookup = "GC_ACCOUNT_Z:DataPool" Application.BasicFunctions.DoInvoke "Lookup", strLookup
I am able to popup the lookup.
But still I am not understanding how to get ID returned by Lookup.
Also Lookup action is not affecting Account view.
Can you please specify where I am going wrong?
Please suggest.
Appreciating your efforts in advance.
Pankaj
|
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 09 Oct 13 6:21 AM
|
fiogf49gjkf0d In the lookup you created "DataPool" the following should be set
Search Field: Whatever you want to search through e.g. Account
ID Field: AccountID
So, the lookup invokes, you will be searching through the Account column. Once selected, the system will return the AccountID field. You can set to the right view |
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 09 Oct 13 6:33 AM
|
Hello Mike,
Many Thanks!
Here are my settings:
Account Table and GC_Account_Z table are having AccountID as a Key Field with 1:1 relationship.
Gc_Account_Z has field DataPool.
Now for Lookup
Main Table: GC_Account_Z
Lookup name: DataPool
Lookup Caption: Data Pool
Search Field: GC_Account_Z.Datapool
ID Field: Gc_Account_Z.Account.Accountid
Name Field: Gc_Account_Z.Account.Account
Now, can you please specify any settings are missing here?
Appreciating you efforts with Thanks in advance,
Pankaj
|
|
|
|
Re: Error while calling lookup with Do Invoke but without function
Posted: 09 Oct 13 6:45 AM
|
fiogf49gjkf0d Your lookup is on the wrong level.
Create a new lookup on Account (not GC_Account_Z)
Then set these:
Main Table: ACCOUNT Lookup name: DataPool Lookup Caption: Data Pool Search Field: Account.GC_Account_Z.Datapool ID Field: Account.Accountid Name Field: Account.Accountid
The account table is linked to GC_Account_Z - so you will be able to select this via the table underneath account as the search field (DataPool).
Now, when you specify the lookup you will use:
"ACCOUNT:Account.GC_Account_Z.Datapool"
|
|
|
| |
| |
|