Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 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 - 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: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.
Greg Ryan
Posts: 3
 
Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 May 06 10:37 AM
fiogf49gjkf0d
Can't find an event that will cause a dynamic data grid to update when a new record is selected
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 May 06 2:50 PM
fiogf49gjkf0d
I'm not sure I understand the scenario completely. Could you provide more detail about the problem?
[Reply][Quote]
Peter H
Posts: 17
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 May 06 12:10 AM

buscopan antiacido

buscopan antiacido website
fiogf49gjkf0d
Either you need to change the SQL for the Grid and refresh the grid, or you need to bind the BINDID, if it is not currently bound to the account record.

I suspect that the latter will do it for you.
[Reply][Quote]
Greg Ryan
Posts: 3
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 May 06 6:09 AM
fiogf49gjkf0d
I have created a data grid in code dynamicaly on a form assosciated with the account screen( a tab). The Code works fine the first time and displays the desired data. However if I select a different account in the account detail screen, the data on my data grid doesn't update. I am able to initiate an event with a mouse click on the datagrid that causes it to update, but I can't find any other way to cause the form to refresh automaticly. I tried putting a reference into the account detail onchange event but that didn't work.

Code:

option explicit

Sub AXFormCreate(Sender)

Dim i
If (Datagrid1.Columns.Count < 1) Then' > 0
For i = 0 To Datagrid1.Columns.Count - 1
Datagrid1.Columns.Item(0).Delete
Next
End If

Call LoadGrid

Call CreateGridColumns

End Sub


Sub GridReload(Sender) ' ********** Can't find an event to trigger this when the Account detail page refreshes
Call LoadGrid
End Sub




Function LoadGrid
Dim objBASIC
set objBASIC = Application.BASICFunctions
Dim mySQL
'Build SQL statement and assign to the grid.sql property
mySQL = "SELECT A1.ACCOUNTID, A2.PROD_NO, A3.PROD_DESC, sum(A2.QTY) as Quanity, Sum(A2.SALES_AMT) as Sales_TTL" & _
" FROM ACCOUNT A1" & _
" LEFT OUTER JOIN KSC_SALES_HIST A2 ON (A1.ACCOUNTID=A2.ACCOUNTID)" & _
" LEFT OUTER Join KSC_PROD_DESC A3 ON (A2.PROD_NO=A3.PROD_NO)" & _
" where A1.ACCOUNTID = '" & objBASIC.CurrentAccountID & "'" & _
" And SALE_DATE between (Getdate() - 365) and getdate()" & _
" Group By A1.ACCOUNTID, A2.PROD_NO, A3.PROD_DESC" & _
" Order by PROD_DESC"



'reassign the sql statement and refresh
Datagrid1.SQL = mySQL
Datagrid1.Refresh



End Function



Function CreateGridColumns
'loop through recordset field listing creating and defining properties of each column added.
'The sql statement must be assigned prior to calling this function as the columns
'field names are defined by referencing the grid recordset.fields listing.
Dim y
With Datagrid1
For y = 0 to 4
.Columns.Add(0)
Select Case y
Case 0
.Columns.Item(y).FieldName = "ACCOUNTID"
.Columns.Item(y).Visible = False
.Columns.Item(y).width = 10
Case 1
.Columns.Item(y).FieldName = "PROD_NO"
.Columns.Item(y).Caption = "Prod Number"
.Columns.Item(y).width = 20
Case 2
.Columns.Item(y).FieldName = "PROD_DESC"
.Columns.Item(y).Caption = "Description"
.Columns.Item(y).width = 50
Case 3
.Columns.Item(y).FieldName = "Quanity"
.Columns.Item(y).Caption = .RecordSet.Fields(y).Name
.Columns.Item(y).Width = 5
Case 4
.Columns.Item(y).FieldName = "Sales_TTL"
.Columns.Item(y).Caption = "Sales Total"
.Columns.Item(y).width = 10
'.Columns.Item(y).Format = "Currency" -- This doesn't work Says isn't valid


End Select
Next
End With
End Function
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 May 06 10:21 AM

xanax and weed yahoo

xanax and weed side effects link
fiogf49gjkf0d
The Form's "Create" event only fire once, the first time the form is loaded into memory. To have the code run each time the current record changes use the Forms OnChange event instead.
[Reply][Quote]
Greg Ryan
Posts: 3
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 May 06 7:03 AM

lexapro and weed safe

lexapro vs weed blog.selvstrik.dk lexapro and weed high
fiogf49gjkf0d
Actually, that didn't work either becuase nothing on the form changed when a differnt accouht was selected.

I ended up putting a edit box on the form with the accountid and used it's onchange event to call the reload.
Thanks for the help.
[Reply][Quote]
Wiston
Posts: 6
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 May 06 8:37 AM
fiogf49gjkf0d
Hello, a little trick that exist is one that you can use in this case, and it's to place the event in a EditBox of Field ACCOUNT.ACCOUNTID in the WhenChange event. In this way when you select a different account each time, you will be completely sure that this field going to change in the MainView of the Account.
Maybe This can Help to you.

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 May 06 2:00 PM
fiogf49gjkf0d
Ah yes. That is a long standing issue with SLX. The Change event won't fire if there's no bound controls on the form. All you need to do is drop a label on and bind it to the primary ID field, then the form's OnChange event *will* fire. However, going off the editbox's change event will accomplish the same.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 May 06 12:53 PM

naltrexone oral reviews

naltrexone reviews for opiate addiction
fiogf49gjkf0d
You could set visible = false on the control you place as well. OnChange fires on an unbound form (it works for Managed Forms) but only if that form is NOT a tab. I think the reason this happens is that when the MainView is loaded, each tab is loaded and cached into memory (firing OnCreate just once). I believe the MainView is what determines if a tab needs an update. Literally every tab form I've ever made has been bound to something, as well as most stock SalesLogix code so it wouldn't surprise me that this is standard behavior. It wasn't until 6.2 that the opportunity screens went dynamic so I wouldn't have expected it to be different yet. v7 should be a different story, especially now that customers are pushing the boundaries of dynamic and inline grid editing.
[Reply][Quote]
Brian Kempe
Posts: 53
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Aug 06 12:53 PM
fiogf49gjkf0d
Thanks I am appying this method to a couple of pages I couldn't get to refresh
[Reply][Quote]
Brian Kempe
Posts: 53
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Aug 06 1:45 PM
fiogf49gjkf0d
OK now it is refreshing, but leaving a ghost. So if:
account 1 has dataA
account 2 has none
account 3 has dataB

Then when I scroll throught accounts my result set down on the tabspane shows "DataA, DataA, DataB"
I am setting the variables = to nothing , but some how I need to force the Edit to blank.
Thanks

--------------------------------------------------------------
sub TOTAL_2004
dim SQL_temp
SQL_temp="SELECT sum(quantity) as qty , sum(Price) as Amount " &_
"FROM sysdba.c_Acct_Line_Orders " &_
" where OrderDate >'01/01/2004 00:00:00' and OrderDate < '01/01/2005 00:00:00' And " &_
" AccountID='"& Application.BasicFunctions.CurrentAccountID &"' "
'msgbox SQL_temp
dim objClass
dim objRS
on error Resume Next
Set objClass=New DataConnection
objClass.Initialize
Set objRS=objClass.ReturnRecordset(SQL_temp)
If NOT IsEmpty(objRS) Then
While NOT objRS.EOF
BEdit11.text = objRS.Fields(0).Value
BEdit12.text = objRS.Fields(1).Value
objRS.MoveNext
WEND
objRS.Close
Set objRS=Nothing
Else
err.Clear
End If
objClassTerminate
Set objClass=Nothing
End Sub
[Reply][Quote]
Brian Kempe
Posts: 53
 
Duplicate please deleteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Aug 06 1:45 PM
fiogf49gjkf0d
please delete
[Reply][Quote]
Marc Johnson
Posts: 252
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Aug 06 12:42 PM
fiogf49gjkf0d
So simple I never saw it. Thanks for this tip. I'm sure I'll be using it in the future.
[Reply][Quote]
Brian Kempe
Posts: 53
 
Re: Dynamicaly created Grid on Sub form of account doesn't update when account detail changes.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Sep 06 11:31 PM
fiogf49gjkf0d
The secret was to check on "Row Select" in the properties
[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/26/2024 12:31:20 PM