Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, May 2, 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 - ADO General
Forum to discuss ADO specific questions for use with SalesLogix. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to ADO General | New ThreadView:  Search:  
 Author  Thread: How to get records to synch across remote offices
Amer
Posts: 10
 
How to get records to synch across remote officesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 May 07 11:45 AM
Hi,

I have developed a form in SLX that inserts multiple records into the history table at once. Everything works except that these records will not synch over to the remote offices. I am not sure what I am missing. My form calls a history class that was used in other code with my own modifications. Here is the class:

Any help would be greatly appreciated as I have hit a brick wall with this.

Option Explicit

Class History
Private m_type
Private m_conId
Private m_startDT
Private m_completedDT
Private m_userID
Private m_desc
Private m_category
Private m_notes
Private m_historyID

Private Sub Class_Initialize()
m_userID = Application.BasicFunctions.CurrentUserID
End Sub

'Here are the "writable" Let properties
Public Property Let HistoryType(ByVal val)
m_type = val
End Property

Public Property Let ContactID(ByVal val)
m_conId = val
End Property

Public Property Let StartDate(ByVal val)
m_startDT = val
End Property

Public Property Let CompletedDate(ByVal val)
m_completedDT = val
End Property

Public Property Let UserID(ByVal val)
m_userID = val
End Property

Public Property Let Description(ByVal val)
m_desc = val
End Property

Public Property Let Category(ByVal val)
m_category = val
End Property

Public Property Let Notes(ByVal val)
m_notes = val
End Property


'Here are the "readable" Get properties
Public Property Get HistoryID
HistoryID = m_historyID
End Property

Public Sub Add
Dim cn
Dim i
Dim counter
Dim rs

Set cn = Application.GetNewConnection

Set rs = cn.Execute("select count(username) from sysdba.username")

counter = rs.Fields(0).Value & ""

for i=1 to counter
m_historyID = GetNewID("history")
next

cn.Execute GetInsertSQL()

cn.Execute("delete from sysdba.webcast")
cn.Execute("delete from sysdba.username")

rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub

Private Function GetInsertSQL()
Dim sql

sql = "insert into history (historyid, type, accountid, accountname,"
sql = sql & "contactid, contactname, startdate, userid, timeless, duration,"
sql = sql & "description, category, notes, longnotes, createuser, createdate, completeduser, completeddate)"
sql = sql & "select "
sql = sql & "a.historyid,"
sql = sql & "'" & m_type & "', "
sql = sql & "b.accountid,"
sql = sql & "b.account,"
sql = sql & "b.contactid,"
sql = sql & "b.lastname + ', ' + b.firstname,"
sql = sql & "'" & m_startDT & "', "
sql = sql & "'" & m_userID & "', "
sql = sql & "'T', "
sql = sql & "'0', "
sql = sql & "'" & Replace(m_desc, "'", "''") & "', "
sql = sql & "'" & Replace(m_category, "'", "''") & "', "
sql = sql & "'" & Replace(Mid(m_notes, 1, 254), "'", "''") & "', "
sql = sql & "'" & Replace(m_notes, "'", "''") & "', "
sql = sql & "'" & Application.BasicFunctions.CurrentUserID & "', "
sql = sql & "'" & GetANSIDate(Now) & "', "
sql = sql & "'" & m_userID & "', "
sql = sql & "'" & m_completedDT & "' "
sql = sql & "from Webcast_View a inner join sysdba.contact b on a.username = b.webusername"

GetInsertSQL = sql
End Function

Private Function GetNewID(ByVal table)
Dim rs
Dim cn

Set cn = Application.GetNewConnection
Set rs = cn.Execute("slx_dbids('" & table & "', 1)")

GetNewID = rs.Fields(0).Value & ""
cn.Execute ("insert into webcast (historyid) values ('" & GetNewID & "')")

rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Function

End Class
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to get records to synch across remote officesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 May 07 11:54 AM
Your problem is likely because of the dates. They must be in ISO format for the statement to sync to remotes. It could also possibly be from the insert into (fields) select ... statement.

The "best" route to take, and avoid the need to format dates as ISO etc, is to use an updateable recordset instead. See http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=76 This gives the provider a chance to affect the data as needed (something that it cannot do with all values inline in a SQL statement). Make sense?

-Ryan
[Reply][Quote]
Amer
Posts: 10
 
Re: How to get records to synch across remote officesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 May 07 1:44 PM
fiogf49gjkf0d
Thanks Ryan for your prompt response. I tried without the dates but it still doesn't work so that rules that option out.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to get records to synch across remote officesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 May 07 1:53 PM
fiogf49gjkf0d
I'd actually be surprised if the SLX provider allowed insert statements in the form of insert into (fields) select ... . I would still go the route of using an updateable recordset as I mentioned before. Guaranteed you won't have the problem then.
[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): 5/2/2024 9:36:38 PM