Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
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!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: DataGrid "SetFieldValue" method.
Greg Mussitsch
Posts: 7
 
DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Aug 06 7:21 AM
fiogf49gjkf0d
I'm trying to use this method to update a cell in a row of a datagrid control but I keep getting "Catastrophic error". I saw the web posting at http://crm.ittoolbox.com/groups/technical-functional/saleslogix-l/change-datagrid-fields-value-by-script-1108159 but my case is very simple. I only have a single string column per row in the grid.

Has anyone been able to get this to work? Is there a service pack or hot fix that takes care of this? As a workaround, is there a way to force the selected row based on the row ID? I'm thinking worst case I could refresh the grid then manually force the selected row to be the row that was selected before the refresh.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Aug 06 12:41 PM
fiogf49gjkf0d
There is a 4th parameter in certain versions of SalesLogix I believe which could cause the issue. Another thing is not having the ID field present on the grid but making the column invisible. I personally hate the idea because GetCurrentField("") returns the primary key and if you were to profile the grid you would see that it is in fact using that value internally. I have a problem with wholesale modification of grids for something like this, it was one of the reasons I rolled my own CascadeDelete function that DIDN'T require overriding the grid's existing delete code.

I would use as much msgbox debugging as possible. I gave the example of something like this: MsgBox "SetFieldValue " + PrimaryKeyValue + ", ENDDATE, " +
dAddOpenDays(dBeginDate, CDbl(sDuration)) + ", True" which should display exactly what the function should be calling. It's possible that it is looking for a value that isn't there, or the data is somehow screwing things up internally.
[Reply][Quote]
Greg Mussitsch
Posts: 7
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Aug 06 12:52 PM
fiogf49gjkf0d
Thanks for the response. I'll debug further but since it's such a straight-forward call I don't have much hope. What I'm ultimately trying to do is update a single row in the grid after returning from a manage form while keeping the selected row selected. If I refresh the grid the whole grid refreshes and I lose the row selection. I figured I could avoid a grid refresh by using "SetFieldValue" to show the current DB value in the selected row's cell after returning from the manage form.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Aug 06 1:15 PM
fiogf49gjkf0d
Ahh I combat that by placing a stringPrimaryKeyValue variable in the Form level and then update it using On* events. This way the value is persisted in the event of a refresh but you can still get to it when necessary. There's the possibility that using the right event will trigger the update during a refresh, OnRowSelect or OnChangeNode being the places this would most likely happen. You'll also want to put in some security to make sure that it doesn't just use the last value but has a way of verifying that the events that lead up to this point functioned correctly. You don't want to use the primary key you captured 3 calls ago or you'll have a more fun time debugging that one.
[Reply][Quote]
Greg Mussitsch
Posts: 7
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Aug 06 7:22 AM
fiogf49gjkf0d
How does this help with making a specific row in the grid the selected row? Sorry - you may have lost me. Basically all I want to do is refresh a particular row in a grid (so the current DB values are displayed) without having to refresh the whole grid. I'm hoping to keep the row selected while refreshing the row.
[Reply][Quote]
Greg Mussitsch
Posts: 7
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Aug 06 11:01 AM
fiogf49gjkf0d
Disregard. I can now force a row to be selected and update columns within a row.

Forcing a row to be selected by primary key works as follows:

With DataGrid1.Selection
.Clear
.Add strPrimaryKeyValue
End With


Updating the columns of a selected row works as follows:

DataGrid1.SetFieldValue strPrimaryKeyValue, strColumn, strValue, blnUpdateRecordset


The key step I was missing is that in both cases the primary key column must be manually added as a column in the data grid's layout then set to hidden via the columns property pages (as opposed to the default SLX data grid primary key behavior). Thanks for taking the time to help me with this.

[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Aug 06 11:55 AM
fiogf49gjkf0d
Quote:
Originally posted by Greg Mussitsch

What I'm ultimately trying to do is update a single row in the grid after returning from a manage form while keeping the selected row selected.

I gave you my workaround for the selection method (it isn't exposed in 6.1). You store a value before the edit or add, let the underlying forms do their thing, then do processing on the primary key you stored back in step 1.

I personally never liked having to add the primary key column manually and I believe in 6.1 there wasn't a visible property on columns, which meant a bit of magic to get them out of the way. I'll be adding them to every grid from now on though since there is more than one method that relies on them being there.
[Reply][Quote]
Lane
Posts: 121
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 7:46 AM
fiogf49gjkf0d
Be careful with this, it only works if the record in question is visible in the grid. For example, if you select the top 10 rows in a grid that can display 50, your fine. But, if you select rows 45-55 in the same grid 45-50 will the hi-lighted and 51-55 will not be, even when you scroll (matter of fact 45-50 won't be either if you scroll them off the visible range of the grid manually). The same applies if you select row 100 and the grid displays from row 1. So, make sure you move the active row into the visible range of the grid, and don't go wild with it.
I also believe the grid internals only track what it originally hi-lights, so 45-50 in the second example. I tracked the selected IDs separately to support further functionality.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: DataGrid "SetFieldValue" method.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Aug 06 2:34 PM
fiogf49gjkf0d
The "trick" to being able to edit any row (in teh recordset) is to check the "sorted" property for the grid. Sorted is really a code-word for Load all records form the datagrid's recordset into memory
--
RJL
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 8:07:51 PM