No announcement yet.

Inconsistency in Form Settings->SQL column name handling with "-" character.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Inconsistency in Form Settings->SQL column name handling with "-" character.

    I am using ScriptCase V 8.1.017 with MySQL.

    I wanted to create a grid form that was sorted on one column. I didn't need to add a column sorting option so I used Form-Settings->SQL and added a column in the Order By section. The field I was sorting on was named "Rate-Percent". The documentation is not clear as to the rules here so I tried the column name unquoted and then with all types of quotes and back-ticks - nothing worked.

    I then renamed the table column to Rate_Percent and typed it into the Order By section with no quotes and it worked.

    So, there appears to be a restriction/bug in the code that handles the column name. Specifically the column name cannot have a "-" character in it. I always avoid spaces in column names as it can lead to lots of quirky SQL errors so '-' and "_" are used often to improve readability. What the forms' SQL handler should do is spot the "-" character and then apply back-ticks to the whole column name.

    The odd thing is that my key field is named VAT-Code and, looking at the generated SQL for the form, it actually does quote it. So, why quote the primary key field but not the other column?

    There have been a few posts asking how to pre-sort a grid form and I wonder is any of them were actually fighting this "bug" rather than not understanding ScriptCase?

    Copy posted to support.

    David Goadby, North Wales.
    David Goadby, North Wales.