3/16/2026 4:34:22 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.
|
|
|
|
Is there a way to have one recordset for all the selected datagrid rows?
Posted: 08 Jan 08 2:24 PM
|
I understand that we can retrieve the selected datagrid row's ids but can we easily retrieve the other columns in the recordset?
I know about the following to retrieve the IDs for the selected datagrid rows...
For i = 0 to DataGrid1.Selection.Count - 1 id = DataGrid1.Selection(i) ' do something with the ID value idlist = idlist & id & vbCrLf Next
and ...
Set objRS = GetSelectedRecordByID(grdProducts.Recordset, strCrntRecord, "KEYFIELDID")
But is there an easier way to just cycle through the recordset for all the selected datagrid rows? Right now, both these steps are needed (1) get the selected IDs and (2) for each ID, get the recordset where one row is one recordset.
Is there a way to have one recordset for all the selected datagrid rows?
Just wondering. Sherri |
|
|
|
Re: Is there a way to have one recordset for all the selected datagrid rows?
Posted: 08 Jan 08 2:54 PM
|
Sure. Do this:
Dim idlist ' get a list of all ID values For i = 0 to DataGrid1.Selection.Count - 1 idlist = idlist & "'" & DataGrid1.Selection(i) & "'," Next ' trim off trailing comma If Len(idlist) > 1 Then idlist = Left(idlist, Len(idlist)-1) ' now open the recordset Set rs = Application.GetNewConnection.Execute("select * from " & Left(DataGrid1.KeyField, Len(DataGrid1.KeyField)-2) & " where " & DataGrid1.KeyField & " in (" & idlist & ")") ' now do what you want with "rs" - this is a recordset of the selected rows
There are better ways to get the recordset query so you can retain the same base query that the grid is based on. Just locate the WHERE part of the query and stick in the part for the primaryid in the IDList. KWIM? |
|
|
|
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!
|
|
|
|
|
|
|
|