6/20/2025 10:31:29 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
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!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Does Application.MainViews.ActiveView.ShowIDsAsLookupResult reorder the ID List?
Posted: 28 Sep 07 2:24 PM
|
Does anyone know if Application.MainViews.ActiveView.ShowIDsAsLookupResult reorders the passed in ID List? I have a certain order (custom date field) that I want to flip through Opportunities from the Contact Opportunities data grid. I have ordered the datagrid and when I create the list of opportunity IDs and pass in the desired Opportunity ID which is the first ID in my list but when shown in the Lookup group, the desired record in not the first record but mid range.
In fact, I have gone as far as looking at the passed in ID string called from SLX_Common OpenMainViewFromGridCrntID module and I see that my desired ID is the first in the list but again when it goes to the ShowIDsAsLookupResult, it appears to have sorted the IDs in ASC order.
Any ideas? |
|
|
|
Re: Does Application.MainViews.ActiveView.ShowIDsAsLookupResult reorder the ID List?
Posted: 13 Nov 07 12:01 PM
|
Yes this is not good. The desired result is that a user double-click an entry in a datagrid and the resulting 'Lookup Results' group remains in the order that they were in the grid.
What happens is just what you explained: the order you send in the IDs gets modified. If you look at the group pane, you can see that it is now likely sorted by some other column.
I believe it is related to the 'QuickFindLookup' property on the main view. The description of this property is 'Also determines default layout of temporary group created for pre-defined lookups'. This is where it gets the columns for the layout (query), but I do not see anywhere a sort order is defined for a lookup.??
Once the main view is created, you can access a READ ONLY property called: CurrentGroupSQL
You will notice that naughty little saleslogix has appended an order by {Mainview.QuickFindLookup.Searchfield} clause to your list of IDs. |
|
|
|
Re: Does Application.MainViews.ActiveView.ShowIDsAsLookupResult reorder the ID List?
Posted: 13 Nov 07 2:53 PM
|
Here is a work-around (for grids that are hard sorted via SQL property):
Create a new field to store the sort order Create a new lookup with the searchfield set to the new sort order field Set the mainview quickfindlookup to the new lookup Add the new sort order field to your grid SQL
Use SLX_Common:OpenMainViewFromGridCrntID as a template for your new sub. The key is that as you build your ID list, you also update the SORT_ORDER field.
Here are the key changes:
'======================================================= Sub strSortOrderFieldName = "SORT_ORDER"
strIDList = GetIDsSetSortOrder(strKeyField,objGrid,strSortOrderFieldName)
Application.MainViews.ActiveView.ShowIDsAsLookupResult strIDList, strCrntID
End Sub '====================================================== Function GetIDsSetSortOrder(strKeyField, objGrid,strSortField) 'Get a RecordSet object from the Connection object objRS.Open strSQL, objSLXDB.Connection
'Read each ID objRS.MoveFirst For intRecord = 0 To objRS.RecordCount - 1 strValue = strValue & "'" & objRS.Fields(strKeyField).Value & "',"
'Set the SORT_ORDER field objRS.Fields(strSortField).Value = intRecord objRS.MoveNext Next objRS.UpdateBatch
'Remove trailing comma GetIDsSetSortOrder = Mid(strValue,1,Len(strValue)-1)
End function '======================================================== Hope this helps, I wish there was a cleaner solution... |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|