Announcement

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

    CHAR Column in Database - mapped to text field in DataSource

    Dear Team,

    For a DataSource named "DEPARTMENT", I have a column named "COM_CODE" of type CHAR(5) but user can store any length which is less than 5.

    I have decleared the filed in the Data Source as follows

    Code:
    <field name="COM_CODE" type="text" length="5"/>
    In the Dynamic Form this column is showing as a text box where is user is allowed to enter text but the problem is trailing spaces are coming to the end because the column in the database is CHAR(5)
    So I was asked to do TRIM while fetching and store it as it is while storing.
    So I have written the filed as follows.

    Code:
    <field name="COM_CODE" type="text" length="5" customSelectExpression="TRIM(COM_CODE)"/>
    After writing this, because I have written customSelectExpression for this column, the column values are not stored in the Database then onwards.
    What should I do to overcome this problem.

    Hope for your reply.

    We are working on the below environment:
    SmartClient version : Isomorphic SmartClient/SmartGWT Framework (10.0p_2014-12-23/PowerEdition Deployment 2014-12-23)

    Browser : IE9

    Thanks in advance.

    #2
    This looks to be a question about how to write SQL for your particular database. This isn't an area where Isomorphic provides support (because we didn't create the database product you are using).

    You can see the queries and statements SmartClient is performing in the server logs, and troubleshoot them by running them directly, without SmartClient involved. Then, properties such as customSelectExpression and customInsertExpression will allow you to adjust the SQL to match whatever you determine to be correct for your particular combination of database engine and version, and JDBC driver and version.

    Comment


      #3
      Note also in the docs of customSelectExpression that when it is provided, the field will no longer be writable by default unless you also provide a customUpdateExpression.

      Comment

      Working...
      X