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

    .ds.xml-generated criteria bug (true-value for boolean fields)

    Hi Isomorphic,

    please see this v10.1p_2016-04-08 BuiltInDS-based testcase, where the generated SQL-WHERE is not as expected ("true" value is not generated as expected). See this thread.

    animals.ds.xml addition:
            <field name="myFalse" title="Dummy field (false)" type="boolean" sqlStorageStrategy="singleCharYN" customSelectExpression="'N'"/>
            <field name="myTrue"  title="Dummy field (true)"  type="boolean" sqlStorageStrategy="singleCharYN" customSelectExpression="'Y'"/>
                <operationBinding operationType="fetch">
                    <criteria _constructor="AdvancedCriteria" operator="or">
                        <criterion fieldName="myFalse" operator="equals" value="false" />
                        <criterion fieldName="myTrue" operator="equals" value="true" />

    The generated SELECT is:
     SELECT   COUNT( *)
         FROM animals
        WHERE(('N' = 'N'
        AND 'N'   IS NOT NULL)
        AND(LOWER(animals.commonName) LIKE LOWER('a%') ESCAPE '\'
        AND animals.commonName IS NOT NULL)
        [B]AND('Y'                 = 'N'[/B]
        AND 'Y'                IS NOT NULL))
    Besides the same bug as in the linked thread above, I'd expect the comparison to be "'Y' = 'Y'".

    Best regards

    So the problem here is that, specifying criteria in XML, you need to use <value xsi:type="xsd:boolean">true</value> to explicitly give type to the value if the value is not of String type. We cover this as a best practice in the AdvancedCriteria doc. However note that, for this particular case, we plan to make the parsing more tolerant such that your value "true" will automatically be interpreted as a boolean true.


      We've made changes mentioned earlier, "true" value from your sample will now be treated as a boolean true. You may retest with nightly builds from Apr 19.

      Note that the bug from this thread is also fixed and available in builds since Apr 18.