As of SLX 7.5 LAN, you can now set the default comparison operator in lookups to be something other than “Starting With”.

Lookups which exist as controls on forms are the easiest to adapt, as they already have a DefaultLookupOption property exposed on their property page, so you can just change that in Architect.

For button lookups such as the “Account” button on the Account Detail view, that calls a FunctionLookupClick function, which is already using code to launch the lookup, via the Application.BasicFunctions.DoInvoke method. That would need to be rewritten to use the LookupItemWithConditionByID function instead.

For launches which are being done from menu/toolbar/navmenu items, instead of launching the lookup directly those would now need to run a new script, which in turn launches the lookup. For example, to launch the Account lookup with conditions from a menu item, and then have the Account record selected by the user in the lookup be loaded into SLX, you’d have the menu-item’s Action execute a VB Script (ActiveScript) containing the following code:

Sub Main

     Dim objLookup

     ' Ignore the blog-formatting line breaks here:
     Set objLookup = Application.BASICFunctions.LookupItem
        WithConditionByID("Account:Account", False, "", "",
        "", "", 2)

     If TypeName(objLookup) = "Link" then
          ' If type <> "Link" then the user Cancelled
          Application.BasicFunctions.DoInvoke "MainView", _
               "System:Account Details"
          Application.MainViews.ActiveView.CurrentID = objLookup.ID
          Set objLookup = Nothing
     End if

End Sub

You could save several steps by using ShowMainViewFromLookupWithConditionByID instead.

From the LAN Developer’s Guide .chm (not the PDF, where they aren’t given!), the enumerated constants which can be used for the last parameter of the LookupItemWithConditionByID function are:

loDefault = 0 (means Starting With for string fields and Equals for all other fields)
loStartingWith = 1
loLike = 2
loEquals = 3
loNotEquals = 4
loLTE = 5
loGTE = 6
loLT = 7
loGT = 8


One Response to Lookups

  1. […] Add an item to the Lookup main menu (in the Standard Menu plugin) to launch your MyEntity lookup via a script, using the LookupItemWithConditionByID function (example) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: