Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, June 19, 2025 
 
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 - SalesLogix Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Clear Grid Cell only working on first row..
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 8:19 AM
I have an editable grid with a drop down indicatiing 'Fixed' or 'Variable'. In the OnEdited event of the grid I am checking that field and clearing other fields where appropriate. This code works great on the first record of the grid, but seems to be ignored by other records in the grid.

Any thoughts?


Function dgTrancheEdited(Sender, PrimaryKeyValue, FieldName, Value)
Select case dgTranche.GetCurrentField("TrancheFixedVar")
case "Fixed"
dgTranche.SetFieldValue dgTranche.getcurrentfield("C_Tranchesid"), "TrancheSpread", null
dgTranche.SetFieldValue dgTranche.getcurrentfield("C_Tranchesid"), "TrancheIndex", null
'msgbox dgTranche.getcurrentfield("C_Tranchesid")
Case "Variable"
dgTranche.SetFieldValue dgTranche.getcurrentfield("C_Tranchesid"), "TrancheCash", null
' msgbox dgTranche.getcurrentfield("C_Tranchesid")
End Select

frmSubTranche.post
dgTranche.refresh
CalculateDisplayCurrency(Sender)
End Function
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 07 9:48 AM
I don't know for sure, so I'll throw some ideas your way. From what I learned on the Opportunity Products screen, changes to the datagrid do not mean changes to the recordset, which means no changes to the database. Also, I think you might want to make sure your keyfield is set correctly.

These things might not make any difference, but I know that's the next place I'd look.
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 07 11:26 AM
Thanks Jeff. Keyfield is set correctly. Updates to DB don't seem to be an issue either..
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 07 11:42 AM
Ooops, sorry that didn't help.

<-- I blame it on the dog.

Anyway, since I'm throwing ideas your direction (even if they might turn out ineffective), I was thinking that after you update the row, something in the grid resets itself - so the GetCurrentField call actually points to the first row each time. The function passes you the PrimaryKeyValue, so I would use that variable in place of dgTranche.getcurrentfield("C_Tranchesid"), and use the variable called Value in place of dgTranche.GetCurrentField("TrancheFixedVar").

It looks like, with the message boxes, you were looking to see if the right primary key value was being passed, and you never mentioned that it wasn't, so the above recommendation might not apply in that case. However, my original concern applies - something happens when a grid is updated - things are reset. So the OnEdited event might be too late to easily do what you are trying to do. You may either want to use the OnEditing event or you may want to just mess with the recordset behind the grid.
[Reply][Quote]
Noah
Posts: 7
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 07 12:02 PM
try using
dgTranche.SetFieldValue PrimaryKeyValue, "TrancheSpread", null, true
instead of
dgTranche.SetFieldValue dgTranche.getcurrentfield("C_Tranchesid"), "TrancheSpread", null
this will give you the PK of the edited row, not the currently selected row.


also you should enclose the entire block of code in
If FieldName = "TrancheFixedVar" then
...
...
...
end if
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 07 8:51 PM
Thanks all. Problem persists.. tech support is supposed to send me a possible solution.. Still open to suggestions. I guess I'm golden if I limit my grids to one row.
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Jul 07 9:35 AM
Alright, I have decided to take another approach. I have tried many many things and all seem to have a flaw - quite often based on whether the events are firing or not.

After trying many many combonations of solutions, I have decided to go with a sub routine that uses a seperate SQL call, loops through the recordset and check for certain conditions, then sets the value accordingly (ie sets negative values to null).

This works great, except for refreshing the grid after.

What event should/could this be called from? If I call the sub from the wrong event with a dg.refresh, I get an exception and the grid goes blank. I have tried just about everyevent.

My closest solution has been to call from the OnChangeNode or dgEdited event and use a refresh button. This is still not 100% correct plus I would like to do away with the refresh button.

Thanks

[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Clear Grid Cell only working on first row..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Jul 07 2:02 PM
Coulple of simple tips:
1) Use temp variables, as often as possible. Get sick of using them. Seriously. Multiple GetCurrentField calls to a grid are a performance hit when calling a temp variable is nothing.
2) Use msgboxes to determine when something fires and when roughly you need to make your changes.
3) GetCurrentField("") is the equivalent of GetCurrentField("PrimaryKeyId"). This uses the grid's internal property whereas .selection requires a hidden (or visible) primary key be added to the grid's layout.
4) Use multiple functions to complete a loop if necessary. For example prior to a delete I'll store the ID, then OnDelete finish up processing.
5) A continuation of #4 is let the control do it's thing first. Since the grid handles deleting the main record, doing it myself is pointless.

I'd suggest #1 and 2 first. Once you figure out how everything fires you can work through #4. There should be a way to do what you're asking but it'll probably involve some clever hacking.
Jeremy
[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 © 2025 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): 6/19/2025 10:33:05 AM