8/28/2025 3:27:10 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.
|
|
|
|
Nightmares with DataGrids - updating custom field in a disconnected recordset
Posted: 19 Mar 09 9:41 AM
|
Not sure what I'm doing wrong here.
I have a simple form that I'll be using to merge two records in my SERVICE table. Firing up the form populates the SQL for a datagrid with the records I want to update. I need to add a new column to the data to hold the "merge/primary/ignore" option - not in the database I need to be able to change the value in the datagrid.
I'm getting a problem though with catatrophic failures, or errors in multi-step processes and so forth at the point of doing the update to the field.
Another question I also have is: is my data actually disconnected from the database? If not, how do I load up a datagrid with arbitrary data?
' Load up some data Dim Sql Sql = "SELECT SERVICEID, 'Merge' MERGEACTION, SERVICENAME, SERVICETYPE FROM SERVICE WHERE SERVICEID IN (" & Records & ")" uxServiceList.SQL = Sql uxServiceList.KeyField = "SERVICEID" uxServiceList.Refresh
Dim col With uxServiceList Dim rs Set rs = .Recordset Dim fld For Each fld In rs.Fields Set col = .Columns.Add(0) col.FieldName = fld.Name col.Caption = fld.Name If col.Caption = "MERGEACTION" Then col.Width = 50 col.Caption = "Merge Action" End If If Right(LCase(fld.Name), 2) = "id" Then col.Visible = False Next .Refresh End With
With uxServiceList Dim rs Set rs = .Recordset Dim PrimarySet PrimarySet = False rs.MoveFirst Do While Not rs.EOF If PrimarySet = False Then rs.Fields("MERGEACTION").Value = "Primary" PrimarySet = True End If rs.MoveNext Loop .Refresh End With
|
|
|
|
Re: Nightmares with DataGrids - updating custom field in a disconnected recordset
Posted: 31 Mar 09 1:19 PM
|
Mark , how are you initializing this uxServiceList? and which form has this dg? Is it a tab or a managed form?
You should initialize this unbound dataset and populate data before starting to use the merge column field. and When done, you should manually write code to update the dataset contents to the db table(if you want to write back)
|
|
|
|
Re: Nightmares with DataGrids - updating custom field in a disconnected recordset
Posted: 01 Apr 09 9:23 AM
|
OK....just where do you clear out the old columns from the Grid? Or do you just keep .ADD ing to them with each screen? You only have to do this ONE TIME per SLX Session.....so on the OnOpen of the form....see how many columns are in the grid......if it's more than what you had at development time (frequently zero or 1) then you've already set the columns, no need to do it again.
You aren' t trying to write/save anything here, correct?
What is the purpose of the final .REFRESH? to throw out all of the other work that you've done?
BTW, grid.sql = "asdfadfafafadsf " does a grid.refresh
and Set Grid.RecordSet = RS does a grid.refresh
So grid.sql = grid.keyfield = grid.refresh does TWO refreshes....
grid.keyfield = grid.sql =
does one refresh.
|
|
|
|
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!
|
|
|
|
|
|
|
|