Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

Synchronization issue inserting blank strings into numeric fields

Another sync issue surfaced this week in SalesLogix 6.1. This is another one of those fun things to troubleshoot since the data does in fact update on the local database but then is rejected by the remote database in the synchronization process. The problem only exists when using dynamic SQL statements to perform updates or inserts and involves putting blank strings into numeric fields.

A common technique I see in many SalesLogix scripts is where the code grabs the values from textboxes and builds a SQL string. In my case I was grabbing values from other places in the database and using those values in a SQL statement to update other tables. Something like this:

Dim val1
Dim sql

     ' using a value from another table
     val1 = GetAValueFromSomeTable(textbox1.Text)
     sql = "update mytable set myfield = '" & val1 & "'" where something"
     Application.GetNewConnection.Execute sql

     ' or sometimes using a value from a control
     val1 = textbox1.Text
     sql = "update mytable set myfield = '" & val1 & "'" where something"
     Application.GetNewConnection.Execute sql

A pretty common thing you see often in SalesLogix scripts, right? In my case, I was taking some input and then grabbing some associated values from the product tables, along with other values, and then using those in my SQL statements. All seemed fine and appeared to be working as expected.

The problem was that I was updating a float field and the value I was grabbing from the product table turned out to be empty. So my SQL statement had a blank string that I was inserting into a float field. The real problem here was that this statement executed correctly on the local database (as I would expect, the SalesLogix provider works best with strings regardless of the underlying field type - but that's another blog entry). The local database reflected the update correctly. However, when the statement was synchronized out to the remote databases the update/insert statement was rejected because I was inserting a blank string into a float field. So the entire statement was rejected and resulted in the entire change being lost. My guess is that the sync process uses the native database provider, instead of the SalesLogix provider since the change is the result of a sync and not something that needs to sync. The native SQL provider does distinguish between strings and other data types and you'll definately see a problem there.

However, as I mentioned before the result of attempting to insert a blank string into a numeric field is that you'll see the data correctly inserted into the table on the local database, but it will never end up in the remote database as it will be rejected by the sync process once it is attempted to be retrieved into the remote database. I should also point out that this only applies to building SQL statements dymanically. If you use updateable recordsets to perform your inserts & updates then you won't see this problem.

What's This?
Bookmark and Share

About Ryan Farley

   Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

View the SalesLogix Mobile Seveloper Series
View the SalesLogix SData Developer Series
View the Git for the SalesLogix Developer series

Related Content
   Small Change for Customizations in Infor CRM (Saleslogix) Mobile 3.3 and Higher
There is a small change needed for mobile customizations in Infor CRM (Saleslogix) Mobile version 3.3 and
Posted on May 14, 2015 by Ryan Farley to Ryan Farley's Blog
   Better Code Organization for Infor CRM (Saleslogix) Mobile Customizations
When customizing the Infor CRM (Saleslogix) Mobile client, it's common for the ApplicationModule to g
Posted on May 05, 2015 by Ryan Farley to Ryan Farley's Blog
   Problem Showing All Area, Category, and Issue Values in Infor CRM (Saleslogix) Mobile And How to Fix
There is an issue with the Infor CRM (Saleslogix) Mobile client where, if you have a large list of Area,
Posted on Apr 24, 2015 by Ryan Farley to Ryan Farley's Blog
   Index of Posts for Starting with Infor CRM (Saleslogix) Development
The blogs on customerfx.com go all the way back to 2003. There's years and years worth of information
Posted on Dec 30, 2014 by Ryan Farley to Ryan Farley's Blog
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog

No Comments

Leave a Comment

All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register