Page 1 of 1

SDAC 4.50 DefaultExpression error

Posted: Thu 19 Jun 2008 14:18
by RandySill
The latest 4.50 releases (0.34 and 0.35) as well as 4.35 have a defect using DefaultExpression to populate data fields on Append. If TMSQuery fields have a default expression and you execute the method Append, you immediately get an error "Invalid Field 'False', Invalid Field P...". For some reason, the component is trying to do a “SELECT False, False, P, 0, True” statement during the append statement with all the default values of any fields that have one.

Any one else experience this issue?

Posted: Fri 20 Jun 2008 08:22
by Antaeus
You should quote default expression values if you do not want them to be requested from the server. For example, 'True' instead of True, 'P' instead of P, etc. But there is no need to quote numbers.
In the next build of SDAC we are planning to add recognizing unquoted True/False values in DefaultExpression.

Posted: Fri 20 Jun 2008 11:49
by RandySill
That's not the behavior of 4.10 and previous. When I set the DefaultExpression value of a string field to a quoted value such as 'P', the quotes are getting added to the data field. If I quote a boolean field with 'False' or 'True', I get an error that 'False' is not a valid boolean value for field 'IsCompany'. Is SDAC now fetching default values from the server to pre-populate in an Append? I currently don't have default values at the server and this will be quite an extensive change to upgrade if this is now normal behavior. What version did this change take place?

Posted: Fri 20 Jun 2008 12:19
by RandySill
Ok, I re-upgraded to 4.50.0.35 and see how DefaultExpression is now used. This behavior now makes SDAC different than standard DataSet components in the way DefaultExpression values are handled. It also makes another round trip to SQL Server for an append. I can see some nice capability in using a feature like this, but if it were me, I would have made it an alternate property or possibly an option. I will have to change thousands of values to be compliant with this new change which makes this a breaking upgrade. Is there any way to disable this method of fetch? I must now change every instance of boolean defaults (True and False) to 1 and 0 as these are the SQL values.

Posted: Fri 20 Jun 2008 12:55
by Antaeus
You should change the DefaultExpressionOldBehavior variable to True somewhere in your program to return the old behavior with default expressions.

Posted: Fri 20 Jun 2008 13:12
by RandySill
Awesome! That's a life saver. Thanks for the reply.