Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 6, 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 - 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: Dynamic Listview control
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Dynamic Listview controlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 10:51 AM
I am populating a listview with code. I can't seem to break it into columns, get the headers to work and the column I get is truncated.

Does anyone know of any sample code in SLX that dynamically populates and formats a listview, or other documentation to assist with this? Thanks
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Dynamic Listview controlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 07 4:22 PM
In 6.2 and Above I've only used predefined Columns, Items, etc.
But here's the listview build code:

'Including Script - System:SLX Database Support
'Including Script - Personal:ASI_Scripts
option explicit

Sub ExecSQLClosedOpps(TheType)
Set newRow = lstClosedOpps.Items.Add
newRow.tag = TheTYPE & "s"
newRow.caption = TheTYPE & "s"
g_AccountTypeFilter = " AND ac.Type = '" & g_AccountType & "' "
g_AccountFilters = g_AccountTypeFilter & g_AccountUsersFilter & g_AccountDEPTSFilter

g_MonetaryAmount = 0.00
g_LaSalleDepartmentFilter = " AND p.SUPPLIER = '" & g_LasalleDefaultDepartment & "' "

strSQL = "SELECT ISNULL(Monetary_Amount,0.00) AS Total FROM ASI_Opp_Product aop, Product p, Opportunity opp, Account ac "
strSQL = strSQL & " WHERE aop.ProductID = p.ProductID AND aop.OpportunityID = opp.OpportunityID AND opp.AccountID = ac.AccountID "
strSQL = strSQL & g_AccountFilters & g_OppProductActualCloseDateFilter
strSQL = strSQL & g_OppProdStageFilter & g_LaSalleDepartmentFilter
Set RS_DB = objCon_DB.GetNewRecordSet
RS_DB.Open strSQL, objCon_DB.Connection
KOUNTER = 0
While Not RS_DB.EOF
KOUNTER = KOUNTER + 1
g_MonetaryAmount = g_MonetaryAmount + getNumericValue(RS_DB,"Total")
RS_DB.MoveNext
Wend
' Col 1
newRow.SubItems.Add cSTR(KOUNTER)
' Col 2
newRow.SubItems.Add FormatCurrency(g_MonetaryAmount,0)

END SUB

SUB ExecSQLNumOfAccounts(TheTYPE)
DIM TotalTotal
Set newRow = lstNumOfAccounts.Items.Add
newRow.tag = TheTYPE & "s"
newRow.caption = TheTYPE & "s"
g_AccountTypeFilter = " AND ac.Type = '" & g_AccountType & "' "
g_AccountFilters = g_AccountTypeFilter & g_AccountUsersFilter & g_AccountDEPTSFilter

strSQL = "SELECT Count(ac.AccountID) AS Total FROM Account ac WHERE 1 = 1 "
strSQL = strSQL & g_AccountFilters
CALL AddListItemValue

CALL ExecSQLNumOfAccountsByTier("A")
TOTALTOTAL= cLNG(TheValue)
CALL ExecSQLNumOfAccountsByTier("B")
CALL ExecSQLNumOfAccountsByTier("C")

strSQL = "SELECT Count(ac.AccountID) AS Total FROM Account ac INNER JOIN ASI_ACCT_Ext asi ON ac.AccountID = asi.AccountID "
strSQL = strSQL & " WHERE asi.Rhythms_Status = 'Active Rhythms' "
strSQL = strSQL & g_AccountFilters

CALL AddListItemValue

'''''the way we'll calculate No recent history is by taking total A Accounts and subtracting A Accounts WITH history,.
strSQL = " select Ac.AccouNTID, Count(HISTORYID) "
strSQL = strSQL & " from sysdba.account ac "
strSQL = strSQL & " left outer join history h on ac.accountid = h.accountid "
strSQL = strSQL & " join sysdba.ASI_ACCT_EXT asi on ac.accountid = asi.accountid "
strSQL = strSQL & " where h.COMPLETEDDATE > (GETDATE() - 30) AND h.COMPLETEDDATE < (GETDATE() + 1) AND asi.Marketing_Tier = 'A' AND h.type > " & minANHtype & " and h.type < " & maxANHtype & g_AccountFilters & " "
strSQL = strSQL & " group by AC.ACCOUNTID "

Set RS_DB = objCon_DB.GetNewRecordSet
RS_DB.Open strSQL, objCon_DB.Connection
KOUNTER = RS_DB.RecordCount
TheValue = TOTALTOTAL - KOUNTER
IF TheValue < 1 THEN TheValue = 0
'''''''''' MSGBOX cSTR(TheValue) & " " & cSTR(TOTALTOTAL) & " " & cSTR(KOUNTER)
newRow.SubItems.Add TheValue

END SUB

Function GetValue(RecordSet, FieldName)
If Not IsNull(RecordSet.Fields(FieldName)) Then
GetValue = RecordSet.Fields(FieldName).Value
Else
GetValue = ""
End If
End Function

Function GetNumericValue(RecordSet, FieldName)
If Not IsNull(RecordSet.Fields(FieldName)) Then
GetNumericValue = cDBL(RecordSet.Fields(FieldName).Value)
Else
GetNumericValue = 0
End If
End Function

Sub AddListItemValue
Set RS_DB = objCon_DB.GetNewRecordSet
RS_DB.Open strSQL, objCon_DB.Connection
If Not RS_DB.EOF Then
TheValue = getValue(RS_DB,"Total")
newRow.SubItems.Add TheValue
Application.Debug.WriteLine " The Value: " & TheValue & " SQL" & strSQL
Application.Debug.WriteLine ""
End If
END SUB



[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/6/2025 9:57:59 PM