Announcement

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

    Datasource cannot load data from database

    Hello there,

    I am using a licence copy of SmartGWT Power 3 and testing on Firefox browser version 26.

    I am trying to load a listgrid with data from many tables(they have foreign key relationship). When I run my application I get this
    Response in my Developer Console

    Code:
    {
        affectedRows:0, 
        data:"The multi-part identifier \"CusNeiGroupDS.province\" could not be bound.", 
        invalidateCache:false, 
        isDSResponse:true, 
        queueStatus:-1, 
        status:-1
    }
    and this is my DSRequest

    Code:
    {
        dataSource:"CusNeiGroupDS", 
        operationType:"fetch", 
        componentId:"isc_ListGrid_0", 
        data:{
        }, 
        startRow:0, 
        endRow:75, 
        textMatchStyle:"substring", 
        resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: CusNeiGroupDS, created by: isc_ListGrid_0)], 
        callback:{
            caller:[ResultSet ID:isc_ResultSet_0 (dataSource: CusNeiGroupDS, created by: isc_ListGrid_0)], 
            methodName:"fetchRemoteDataReply"
        }, 
        willHandleError:true, 
        showPrompt:true, 
        prompt:"Finding Records that match your criteria...", 
        oldValues:{
        }, 
        requestId:"CusNeiGroupDS$6270", 
        internalClientContext:{
            requestIndex:1
        }, 
        fallbackToEval:false, 
        bypassCache:true
    }
    This is my DS.xml file

    Code:
    <DataSource ID="CusNeiGroupDS" serverType="sql">
    	<fields>
    		<field name="province" title="province" primaryKey="true" type="text" />
    		<field name="capital" title="capital"  type="text" />
    		<field name="code" title="code"   type="text" />
    		<field name="telcode" title="telcode"   type="text" />
    		<field name="taxcode" title="taxcode"   type="text" />
    		<field name="county" title="county"   type="text" />
    		<field name="district" title="district"   type="text" />
    		<field name="city" title="city"   type="text" />
    		<field name="zone" title="zone"   type="text" />
    		<field name="neighbour" title="neighbour"   type="text" />
    		<field name="taxcodecity" title="taxcodecity"   type="text" />
    		<field name="fdocode" title="fdocode"  type="text" />
    		<field name="countCustomer" title="countCustomer"  type="int" />
    	</fields>
    
    	<operationBindings>
    		<operationBinding operationType="fetch">
    			<!-- <tableClause>province,county,district,city,zone,neighbourhood,customer</tableClause> -->
    			<selectClause>
    			province.capital,
        province.code,
        province.telcode,
        province.taxcode,
        county.countyname as county,
        district.districtname as district,
        zone.alternateName as zone,
        neighbourhood.alternateName as neigbhour,
        city.cityname as city,
        city.taxcode,
        city.fdocode,
    			$defaultSelectClause 
    			</selectClause>
    			<tableClause>
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			</tableClause>
    			<!-- <whereClause>($defaultWhereClause)
    			</whereClause> -->
    		</operationBinding>
    	</operationBindings>
    </DataSource>

    Below is the Server Logs

    Code:
    === 2014-12-10 11:48:53,749 [6-27] DEBUG RPCManager - Processing 1 requests.
    === 2014-12-10 11:48:53,759 [6-27] DEBUG ISCKeyedObjectPool - Borrowing object for 'CusNeiGroupDS'
    === 2014-12-10 11:48:53,759 [6-27] DEBUG PoolableDataSourceFactory - Activated DataSource 26 of type 'CusNeiGroupDS'
    === 2014-12-10 11:48:53,759 [6-27] DEBUG DSRequest - Caching instance 26 of DS 'CusNeiGroupDS' from DSRequest.getDataSource()
    === 2014-12-10 11:48:53,759 [6-27] DEBUG DSRequest - Caching instance 26 of DS CusNeiGroupDS
    === 2014-12-10 11:48:53,759 [6-27] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"CusNeiGroupDS",
            operationType:"fetch",
            textMatchStyle:"substring"
        },
        startRow:0,
        endRow:75,
        componentId:"isc_ListGrid_0",
        appID:"builtinApplication",
        operation:"CusNeiGroupDS_fetch",
        oldValues:{
        }
    }
    === 2014-12-10 11:48:53,759 [6-27] INFO  IDACall - Performing 1 operation(s)
    === 2014-12-10 11:48:53,759 [6-27] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2014-12-10 11:48:53,759 [6-27] DEBUG DeclarativeSecurity - DataSource CusNeiGroupDS is not in the pre-checked list, processing...
    === 2014-12-10 11:48:53,769 [6-27] DEBUG AppBase - [builtinApplication.CusNeiGroupDS_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2014-12-10 11:48:53,769 [6-27] DEBUG AppBase - [builtinApplication.CusNeiGroupDS_fetch] No public zero-argument method named '_CusNeiGroupDS_fetch' found, performing generic datasource operation
    === 2014-12-10 11:48:53,769 [6-27] INFO  SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] Performing fetch operation with
    	criteria: {}	values: {}
    === 2014-12-10 11:48:53,779 [6-27] INFO  SQLWhereClause - [builtinApplication.CusNeiGroupDS_fetch] empty condition
    === 2014-12-10 11:48:53,779 [6-27] INFO  SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] derived query: SELECT 
    			province.capital,
        province.code,
        province.telcode,
        province.taxcode,
        county.countyname as county,
        district.districtname as district,
        zone.alternateName as zone,
        neighbourhood.alternateName as neigbhour,
        city.cityname as city,
        city.taxcode,
        city.fdocode,
    			$defaultSelectClause 
    			 FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE $defaultWhereClause
    === 2014-12-10 11:48:53,860 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] Executing row count query: SELECT COUNT(*) FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE $defaultWhereClause
    === 2014-12-10 11:48:53,860 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] Eval'd row count query: SELECT COUNT(*) FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE ('1'='1')
    === 2014-12-10 11:48:53,910 [6-27] INFO  PoolManager - [builtinApplication.CusNeiGroupDS_fetch] SmartClient pooling started for 'SQLServer' objects
    === 2014-12-10 11:48:53,910 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] Initializing SQL config for 'SQLServer' from system config - using DriverManager:  net.sourceforge.jtds.jdbc.Driver
    === 2014-12-10 11:48:53,910 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] net.sourceforge.jtds.jdbc.Driver lookup successful
    === 2014-12-10 11:48:53,910 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] DriverManager fetching connection for SQLServer via jdbc url jdbc:jtds:sqlserver://localhost:1433;DatabaseName=kaizenweb;useUnicode=true;characterEncoding=UTF-8;sendStringAsUnicode=true;User=test;Password=secret
    === 2014-12-10 11:48:53,910 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] Passing JDBC URL only to getConnection
    === 2014-12-10 11:48:54,399 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] makeObject() created a pooled Connection '28326982'
    === 2014-12-10 11:48:54,409 [6-27] DEBUG SQLConnectionManager - [builtinApplication.CusNeiGroupDS_fetch] Borrowed connection '28326982'
    === 2014-12-10 11:48:54,409 [6-27] DEBUG SQLDriver - [builtinApplication.CusNeiGroupDS_fetch] About to execute SQL query in 'SQLServer' using connection '28326982'
    === 2014-12-10 11:48:54,409 [6-27] INFO  SQLDriver - [builtinApplication.CusNeiGroupDS_fetch] Executing SQL query on 'SQLServer': SELECT COUNT(*) FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE ('1'='1')
    === 2014-12-10 11:48:54,439 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] DriverManager fetching connection for SQLServer via jdbc url jdbc:jtds:sqlserver://localhost:1433;DatabaseName=kaizenweb;useUnicode=true;characterEncoding=UTF-8;sendStringAsUnicode=true;User=test;Password=secret
    === 2014-12-10 11:48:54,439 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] Passing JDBC URL only to getConnection
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLConnectionManager - [builtinApplication.CusNeiGroupDS_fetch] Borrowed UNPOOLED connection '6679247'
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLServerDriver - [builtinApplication.CusNeiGroupDS_fetch] SQL Server version is '10.50.1600'
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] Using SQL Limit query
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] Using PK as default sorter: province
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY province) AS rowID FROM (SELECT TOP 100 PERCENT  
    			province.capital,
        province.code,
        province.telcode,
        province.taxcode,
        county.countyname as county,
        district.districtname as district,
        zone.alternateName as zone,
        neighbourhood.alternateName as neigbhour,
        city.cityname as city,
        city.taxcode,
        city.fdocode,
    			CusNeiGroupDS.province, CusNeiGroupDS.capital, CusNeiGroupDS.code, CusNeiGroupDS.telcode, CusNeiGroupDS.taxcode, CusNeiGroupDS.county, CusNeiGroupDS.district, CusNeiGroupDS.city, CusNeiGroupDS.zone, CusNeiGroupDS.neighbour, CusNeiGroupDS.taxcodecity, CusNeiGroupDS.fdocode, CusNeiGroupDS.countCustomer 
    			 FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE ('1'='1')) x) y WHERE y.rowID BETWEEN 1 AND 75
    === 2014-12-10 11:48:54,439 [6-27] DEBUG SQLDataSource - [builtinApplication.CusNeiGroupDS_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY province) AS rowID FROM (SELECT TOP 100 PERCENT  
    			province.capital,
        province.code,
        province.telcode,
        province.taxcode,
        county.countyname as county,
        district.districtname as district,
        zone.alternateName as zone,
        neighbourhood.alternateName as neigbhour,
        city.cityname as city,
        city.taxcode,
        city.fdocode,
    			CusNeiGroupDS.province, CusNeiGroupDS.capital, CusNeiGroupDS.code, CusNeiGroupDS.telcode, CusNeiGroupDS.taxcode, CusNeiGroupDS.county, CusNeiGroupDS.district, CusNeiGroupDS.city, CusNeiGroupDS.zone, CusNeiGroupDS.neighbour, CusNeiGroupDS.taxcodecity, CusNeiGroupDS.fdocode, CusNeiGroupDS.countCustomer 
    			 FROM 
    				province
    				JOIN county ON province.Id = county.provinceId
    				JOIN district ON district.countyId = county.Id
    				JOIN city ON city.districtId = district.Id
    				JOIN zone ON zone.cityId = city.Id
    				JOIN neighbourhood ON neighbourhood.zoneId = zone.Id
    				JOIN customer ON customer.neighbourhoodId = neighbourhood.Id
    			 WHERE ('1'='1')) x) y WHERE y.rowID BETWEEN 1 AND 75
    === 2014-12-10 11:48:54,449 [6-27] DEBUG SQLConnectionManager - [builtinApplication.CusNeiGroupDS_fetch] About to close  with hashcode "28326982"
    === 2014-12-10 11:48:54,449 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] DriverManager fetching connection for SQLServer via jdbc url jdbc:jtds:sqlserver://localhost:1433;DatabaseName=kaizenweb;useUnicode=true;characterEncoding=UTF-8;sendStringAsUnicode=true;User=test;Password=secret
    === 2014-12-10 11:48:54,449 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] Passing JDBC URL only to getConnection
    === 2014-12-10 11:48:54,449 [6-27] DEBUG PoolableSQLConnectionFactory - [builtinApplication.CusNeiGroupDS_fetch] makeObject() created a pooled Connection '6960514'
    === 2014-12-10 11:48:54,459 [6-27] DEBUG DSRequest - About to free up resources for request of type fetch on DataSource CusNeiGroupDS
    === 2014-12-10 11:48:54,459 [6-27] WARN  RequestContext - dsRequest.execute() failed: 
    java.sql.SQLException: The multi-part identifier "CusNeiGroupDS.province" could not be bound.
    	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
    	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
    	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
    	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
    	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
    	at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1311)
    	at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
    	at com.isomorphic.sql.SQLDataSource.executeWindowedSelect(SQLDataSource.java:2507)
    	at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1907)
    	at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:443)
    	at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:388)
    	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1922)
    	at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726)
    	at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    	at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2543)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:213)
    	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:178)
    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:142)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:76)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:156)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    	at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
    	at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
    	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    	at org.eclipse.jetty.server.Server.handle(Server.java:370)
    	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    	at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
    	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
    	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    	at java.lang.Thread.run(Thread.java:745)
    === 2014-12-10 11:48:54,459 [6-27] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2014-12-10 11:48:54,459 [6-27] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2014-12-10 11:48:54,459 [6-27] DEBUG SQLDriver - Freeing SQLDriver dbConnection 6960514
    === 2014-12-10 11:48:54,459 [6-27] DEBUG SQLConnectionManager - About to close  with hashcode "6960514"
    === 2014-12-10 11:48:54,459 [6-27] DEBUG PoolableDataSourceFactory - Cleared and passivated DataSource 26 of type 'CusNeiGroupDS'
    === 2014-12-10 11:48:54,459 [6-27] INFO  Compression - /builtinds/sc/IDACall: 208 -> 179 bytes

    #2
    So, does the column "province" in the table "CusNeiGroupDS" exist? Your database thinks not.

    You may have simply forgotten to set dataSource.tableName in your .ds.xml if your table is not named CusNeiGroupDS.

    Comment


      #3
      Thanks for your feedback. you see i dont have a table called "CusNeiGroupDS". This is the name of my ds.xml file which I call from my java class like this
      Code:
      listGrid.setDataSource(DataSource.get("CusNeiGroupDS"));
      This is my raw SQL query which runs perfectly well in my database

      Code:
      SELECT
          dbo.province.provincename as province,
          dbo.province.capital,
          dbo.province.code,
          dbo.province.telcode,
          dbo.province.taxcode,
          dbo.county.countyname as county,
          dbo.district.districtname as district,
          dbo.zone.alternateName as zone,
          dbo.neighbourhood.alternateName as neigbhour,
          dbo.city.cityname as city,
          dbo.city.taxcode,
          dbo.city.fdocode,
          count(dbo.customer.customeraltname) as countCustomer
      FROM
          dbo.county
      INNER JOIN
          dbo.province
      ON
          (
              dbo.county.provinceID = dbo.province.id)
      INNER JOIN
          dbo.district
      ON
          (
              dbo.county.id = dbo.district.countyID)
      INNER JOIN
          dbo.city
      ON
          (
              dbo.district.id = dbo.city.districtID)
      INNER JOIN
          dbo.zone
      ON
          (
              dbo.city.id = dbo.zone.cityId)
      INNER JOIN
          dbo.neighbourhood
      ON
          (
              dbo.zone.id = dbo.neighbourhood.zoneId)
      INNER JOIN
          dbo.customer
      ON
          (
              dbo.neighbourhood.id = dbo.customer.neighbourhoodId)
              Group By dbo.province.provincename,
          dbo.province.capital,
          dbo.province.code,
          dbo.province.telcode,
          dbo.province.taxcode,
          dbo.county.countyname,
          dbo.district.districtname,
          dbo.zone.alternateName,
          dbo.neighbourhood.alternateName,
          dbo.city.cityname,
          dbo.city.taxcode,
          dbo.city.fdocode

      Comment


        #4
        So to restate: you're including the $defaultSelectClause in your query, and you have simply called the DataSource "CusNeiGroupDS" and not provided a tableName - so of course the framework is going to generate the name CusNeiGroupDS.province as part of the defaultSelectClause: that's what you configured the system to do.

        What were you expecting to happen instead, and why?

        Comment


          #5
          Should I remove this $defaultSelectClause from my CusNeiGroupDS.ds.xml file. Actually I was not sure if I needed that $defaultSelectClause.

          >>What were you expecting to happen instead, and why?

          I was expecting SGWT to create that raw sql which I posted before and return me the columns which I mentioned in the select clause in the Listgrid. Please bear with me.

          Comment


            #6
            I removed that default clause and now get this error,data:"Invalid column name 'province'."

            Any idea what am I doing wrong.

            Comment


              #7
              Originally posted by Isomorphic View Post
              You may have simply forgotten to set dataSource.tableName in your .ds.xml if your table is not named CusNeiGroupDS.
              Please see the docs.

              Best regards,
              Blama

              Comment


                #8
                Thanks for your feedback. I tried adding the tableName in my field tag and in my datasource primary table,like so.
                Code:
                <DataSource ID="CusNeiGroupDS" serverType="sql" tableName="province">
                	<fields>
                		<field name="id" type="integer" />
                		<field name="provincename" title="province" type="text"/>
                		<field name="capital" title="capital" type="text"/>
                		<field name="code" title="code" type="text"/>
                		<field name="telcode" title="telcode" type="text"/>
                		<field name="taxcode" title="taxcode" type="text" />
                		<field name="countyname" title="county" type="text" tableName="county"/>
                		<field name="district" title="district" type="text" customSQL="true" />
                		<field name="city" title="city" type="text" customSQL="true" />
                		<field name="zone" title="zone" type="text" customSQL="true" />
                		<field name="neighbour" title="neighbour" type="text" customSQL="true" />
                		<field name="taxcodecity" title="taxcodecity" type="text"
                			customSQL="true" />
                		<field name="fdocode" title="fdocode" type="text" customSQL="true" />
                		<!-- <field name="countCustomer" title="countCustomer" type="int" /> -->
                	</fields>
                
                
                	<operationBindings>
                		<operationBinding operationId="summary"
                			operationType="fetch"
                			customFields="district,city,zoneneighbour,taxcodecity,fdocode">
                			<selectClause>
                				districtname as
                				district,
                				alternateName as zone,
                				alternateName as neigbhour,
                				cityname
                				as city,
                				fdocode
                			</selectClause>
                			<tableClause>province, county, district, zone, neighbourhood, city
                			</tableClause>
                			<whereClause>
                                province.Id = county.provinceId
                            AND district.countyId = county.Id
                			AND city.districtId = district.Id
                			AND neighbourhood.zoneId = zone.Id
                			</whereClause>
                		</operationBinding>
                	</operationBindings>
                </DataSource>
                <!-- <operationBindings> <operationBinding operationType="fetch"> <selectClause> 
                	province.provincename, province.capital, province.code, province.telcode, 
                	province.taxcode, county.countyname as county, district.districtname as district, 
                	zone.alternateName as zone, neighbourhood.alternateName as neigbhour, city.cityname 
                	as city, city.fdocode </selectClause> <tableClause> province JOIN county 
                	ON province.Id = county.provinceId JOIN district ON district.countyId = county.Id 
                	JOIN city ON city.districtId = district.Id JOIN zone ON zone.cityId = city.Id 
                	JOIN neighbourhood ON neighbourhood.zoneId = zone.Id JOIN customer ON customer.neighbourhoodId 
                	= neighbourhood.Id </tableClause> </operationBinding> </operationBindings> -->
                Now the cols in the province table are being shown but the col from the county table is not brought and the query which SmartGWt generates looks like this
                Code:
                 
                 SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY id) AS rowID FROM (SELECT TOP 100 PERCENT  province.id, province.provincename, province.capital, province.code, province.telcode, province.taxcode FROM province WHERE ('1'='1')) x) y WHERE y.rowID BETWEEN 1 AND 75
                please help me understand what I am doing wrong or missing.

                Comment


                  #9
                  Hi zaj,

                  how is the framework supposed to generate the join here (there is no custom operation binding used, which is OK)? No information about FK/PK-relationship.
                  See in the docs I linked before: primaryKey, foreignKey, includeFrom.
                  Please make sure that these also appear in your local 3.0p docs, as I don't know if this is already supported in that version.

                  Best regards,
                  Blama

                  Comment


                    #10
                    Blama,Thanks a lot. In the Datasource doc which you linked I don't see those tags. Did you mean in the DataSourceField class.
                    Do I need to add the primary key and foreign key of each table in the field tag or in the whereClause. I am confused here.Can you please help me understand it.

                    >>how is the framework supposed to generate the join here
                    I am in the impression that this whereClause will tell the framework to join these tables.

                    <whereClause>
                    province.Id = county.provinceId
                    AND district.countyId = county.Id
                    AND city.districtId = district.Id
                    AND neighbourhood.zoneId = zone.Id
                    </whereClause>
                    Last edited by zaj; 14 Dec 2014, 23:32.

                    Comment


                      #11
                      Hi zaj,

                      yes, I meant DataSourceField, sorry for the confusion.

                      Your table clause is not used as the whole operationBinding is not used (you used operationId="summary" in the ds.xml, but the default is to go to the no-operationId-default-fetch binding, which you commented out). But it should work nevertheless, given that you provided the missing information and given that 3.0 supports FK/PK-lookup).

                      Missing is:
                      • id: primaryKey="true" (every DS should have a PK, that is also unique in the underlying database/persistence layer)
                      • new field: name="county_id" foreignKey="county.id" (needs a DS named county with a PK-field id (mandatory in this case), make sure to set the correct tableName in the DataSource-tag of this DS as well
                      • countyname: includeFrom="county.countyname", drop the tableName.

                      The same for all the other joined tables (province, district, city, zone). Note that if these form a tree structure, SmartGWT will generate all necessary joins.
                      But I'd start small and see if just the join to county works in the first place.

                      Best regards,
                      Blama

                      Comment


                        #12
                        Blama,thanks once again for your feedbacks. so if I use this method(primary key,foreignKey, includeFrom) then I need not use operationBinding in my DataSource.ds.xml.correct??.

                        Comment


                          #13
                          Correct (if these attributes are available in the DataSourceField-docs of your download).

                          Comment


                            #14
                            cheers. by the way do you also provide consultancy outside the forum too.

                            Comment


                              #15
                              Haha, no.
                              I'm learning to use the framework myself with the product I'm developing. But I can say so far that I really like it and that there was a solution to almost every use case one can have in an enterprise application, so far. Also, if one uses the skinning capabilities, it even doesn't look like a "Microsoft Windows Explorer enterprise application".

                              Besides that, if anyone from the Munich/Germany area is interested in an user group meeting, I'd be very happy to reserve a table somewhere downtown for this.

                              Best regards,
                              Blama
                              Last edited by Blama; 15 Dec 2014, 01:08.

                              Comment

                              Working...
                              X