Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    autoDeriveSchema=“true" & "Must be a Whole Number"

    Be sure your post includes:

    1. v9.1p_2015-08-19/PowerEdition Deployment (built 2015-08-19)

    2a. Chrome Version 44.0.2403.157 (64-bit)
    2b. Firefox 40.0.2

    Hopefully this will be easy to replicate. I have a datasource that points to a table (SQL Server 2005 and SQL Server 2008) that contains a "bit" type field (sqlType="bit") and we set it to a type of boolean. It creates a checkbox on the form. It looks like:
    Code:
    <field name="SOME_RANDOM_FLAG" title="Ready to Rock?" sqlStorageStrategy="number" sqlType="bit" sqlLength="1" />
    If I add ' autoDeriveSchema=“true" ' to the datasource tag in the same file, the checkbox generates a validation error whenever the checkbox is changed: "Must be a Whole Number".

    Code:
    <DataSource serverType="sql" dbName="SQLServer" schema="dbo" autoDeriveSchema=“true" tableName="RandomTable" ID="RandomTable">
    I think the problem lies within the autoDeriveSchema attribute somewhere, because it works fine without that option enabled.

    If it can't be replicated, let me know and I'll see if I can come up with some generic code to recreate it.

    Paul Fincke

    #2
    Your field needs type="boolean".

    As far as why this type wasn't auto-detected with autoDeriveSchema, this could be a problem with how the column is declared, a limitation or bug with SQL Server's JDBC driver, or some kind of problem in our code.

    If you'd like this looked into in case it makes it possible to omit type declarations more often, we'll need to see the table definition.

    Comment


      #3
      This is on Microsoft SqlServer, which does not have a native boolean type. Instead the BIT type is used, with a 0,1, or NULL representing false, true, and unknown.

      Comment


        #4
        This is currently a documented behavior (see autoDeriveSchema docs), with the underlying reason being that we can't reliably detect, across different databases and drivers, whether a given column can really only store one bit. So the type="boolean" suggestion is actually the right and only fix.

        Comment

        Working...
        X