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!
|
|
How to invoke a button launches a lookup?
Posted: 03 Sep 06 9:09 AM
|
fiogf49gjkf0d In my dataform, I have to invoke a button launches a look up to search based on one customized table. I have created this lookup in the "Manage" -> "lookups".
How to implement this requiement? and how can get the lookup id if this lookup opens? |
|
|
|
Re: How to invoke a button launches a lookup?
Posted: 04 Sep 06 8:41 AM
|
fiogf49gjkf0d Hi . There are a BasicFuntion to do this ( I'll sending to you a piece of code) First You Need to set some variables a) strLookupName= "PRODUCT:NAME" 'It's You Custom LookUp Name, In This Case is The PRODUCT LookUp b) objLookup ' Result from the LookupItemWithConditionByID Function c) strPreFill = "" ' /*Other parameter for this Function*/
Set objLookup = Application.BASICFunctions.LookupItemWithConditionByID (strLookupName, False, "", "", "", strPreFill)
'' /*Check Any Error */ If ErrorCheck ("MyOwnLookUpByName: Error Ejecutando Lookup") > 0 Then Exit Function
' /*This is the Result */
If TypeName (objLookup) = "Link" Then '/*If type <> "Link" then the user Cancelled*/ ' Eureka , The Function Works Fine and Return my ID Values strResultID = objLookup.ID ' This is the LookupID values strProductName = objLookup.DisplayName ' This Is the Value Name
Set objLookup = Nothing Else strResultID = -1 End If
---------------------- Enjoy Code
|
|
|
|
Re: How to invoke a button launches a lookup?
Posted: 05 Sep 06 9:14 AM
|
fiogf49gjkf0d Hi there
Besides the way Wiston mentioned, there is the other one: Application.BasicFunctions.DoInvoke "Lookup", strLookupName 'strLookupName is the lookup name
The difference between them is that the former can pass "PreFill" but there is no a check box "Create a temporary group containing all result" below the result grid. The later can Create Temporary Group but there is no room to pass "PreFill".
Wiston, if we need both "Create a temporary group containing all result" and "PreFill", how is it implemented? Do you have any idea about it?
Enjoy
|
|
|
|
Re: How to invoke a button launches a lookup?
Posted: 06 Sep 06 12:57 PM
|
fiogf49gjkf0d I have created one lookup in "manage lookups", but the code: Application.BasicFunctions.DoInvoke "Lookup", strLookupName 'strLookupName is the lookup name
said "the system cannot find the lookup."? Any idea? |
|
|
| |
|
Re: How to invoke a button launches a lookup?
Posted: 06 Sep 06 10:48 PM
|
fiogf49gjkf0d I am using the
'Including Script - System:SLX Lookup Support
LookupByName(strLookup, " ") this will work.
But I need to set the strPreFill, condition is the startdate will greater than today,
Then
strLookupID = LookupByName(strLookup, "StartDate > GetDate() " )
But this one does not work at all. What's wrong with it? |
|
|
| |
| |
|
Re: How to invoke a button launches a lookup?
Posted: 09 Oct 06 12:54 PM
|
fiogf49gjkf0d Try wrapping the Date, provided by the Now function, in quotes.
strLookupID = LookupByName(strLookup, "StartDate > '" & Now() & "'")
Hope this helps...
|
|
|
|
Re: How to invoke a button launches a lookup?
Posted: 23 Jan 07 10:56 AM
|
fiogf49gjkf0d you need to add extra parameters to the lookupbyname function... The strPreFill is only for pre-populating the search field in the lookup
Add a custom function to your code and pass it your restrictions: RestrictField = the DB field to restrict RestrictValue = now() or whatever else you need RestrictOp = ">"
Function myLookupByName (strLookupName, strPreFill, strRestrictField, strRestrictValue, strRestrictOp) Dim objLookup On Error Resume Next Set objLookup = Application.BASICFunctions.LookupItemWithConditionByID (strLookupName, True, strRestrictField, strRestrictValue, strRestrictOp, strPreFill) If ErrorCheck (Application.Translator.Localize("Error executing Lookup:")) > 0 Then Exit Function
If Not (objLookup Is Nothing) Then myLookupByName = objLookup.ID Set objLookup = Nothing Else myLookupByName = -1 End If On Error Goto 0 End Function |
|
|
|