Announcement

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

    sorting by field name no longer works (includeFrom value does)

    You may want to look into this. It was just reported to me this morning. I don't know when it broke, but assume it was in upgrading smartgwt versions. The commented out sort specifier used to work. Now I need to reference the includefile name, rather then the field name.

    //testCommentViewGrid.setSortField("Session_Create_Time"); // Calling out the field name broke somewhere
    testCommentViewGrid.setSortField("Test_Session.Ct_on_Create");
    testCommentViewGrid.setSortDirection(SortDirection.DESCENDING);

    DataSource ds.xml file:

    <DataSource ID="TestCommentView" serverType="sql" tableName="Test_Status">
    <fields>
    <field name="PK_Test_Status" title="*" type="sequence" width="20" align="center" cellAlign="center" primaryKey ="true" prompt="* indicates that this comment is for the current test" cellFormatterrrrrrr="" />
    <field name="FK_Test_Suite" title="FK_Test_Suite" type="integer" width="100" hidden="true" foreignKey="Test_Suite.PK_Test_Suite"/>
    <field name="FK_Test_Record" title="PK_Test_Record" type="integer" width="100" detail="true" />
    <field includeFrom="Test_Session.SessionID" />"
    <field name="Session_Create_Time" nativeName="CT_on_Create" includeFrom="Test_Session.CT_on_Create" detail="true" align="center" cellAlign="center" sortDirection="descending" dateDisplayFormatter="TOEUROPEANSHORTDATETIME" />
    <field name="Comment" title="Test Comment History" type="text" width="*" length="1023" editorType="com.smartgwt.client.widgets.form.fields.RichTextItem" />
    </fields>
    </DataSource>

    The generated SQL for the field name version of the sort omits it in the order by clause:

    === 2019-09-10 13:21:01,103 [-585] DEBUG SQLDataSource - Using SQL Limit query
    === 2019-09-10 13:21:01,103 [-585] WARN SQLOrderClause - DataSource 'TestCommentView': Attempting to sort by field 'Session_Create_Time', but found no native column for the field. Ignoring.
    === 2019-09-10 13:21:01,104 [-585] DEBUG SQLDataSource - SQL windowed select rows 0->75, result size 75. Query:

    SELECT
    *
    FROM
    (SELECT
    *,
    ROW_NUMBER() OVER (
    ORDER BY
    -- Nothing exists here. It should contain Test_Session.CT_on_Create field
    ) AS rowID
    FROM
    (SELECT
    TOP 100 PERCENT Test_Status.PK_Test_Status,
    Test_Status.FK_Test_Suite,
    Test_Status.FK_Test_Record,
    Test_Status.Comment,
    Test_Session.SessionID
    FROM
    Test_Status
    JOIN
    Test_Suite
    ON Test_Status.FK_Test_Suite = Test_Suite.PK_Test_Suite
    JOIN
    Test_Session
    ON Test_Suite.FK_Test_Session = Test_Session.PK_Test_Session
    WHERE
    (
    (
    Test_Status.FK_Test_Record = 33856
    AND Test_Status.FK_Test_Record IS NOT NULL
    )
    )) x) y
    WHERE
    y.rowID BETWEEN 1 AND 75

    #2
    We've modified sample code to show sorting on an included field, and it's working as expected in both 12.0 and 12.1. Also as expected, it does not work to specify a path to a related field as you seem to say works - that wouldn't be expected to work since field names can't have dots in them, among other reasons.

    Let us know if, after further investigation, you still think there's a framework issue here, and how it can be reproduced.

    Comment


      #3
      My apologies. I stand corrected. Upon further investigation,
      1) My relative path "solution" only appeared to work, The framework looks to have substituted in the tables' primary key in the ORDER BY clause.
      2) There was a capitalization issue in the includeFrom and nativeName attribute texts. CT_on_Create -> CT_on_create : an inconsistency across our tables :(

      Comment

      Working...
      X