Announcement

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

    Add additional fields not manually added to the database field list using autoDeriveSchema?

    Hey all, I am trying to access a field from each record that automatically exists in the database for each record but is not a manually added field while using autoDeriveSchema. The field is a "ROWID" field that is automatically created for each record in this database and can be used to get the location of the record in the database.

    When using autoDeriveSchema, this value is not requested so it is not returned. Is there a way to integrate "SELECT ROWID" into the query to retrieve the value from the database, while still using autoDeriveSchema?


    1) SmartClient Version
    v13.0p_2022-01-10/PowerEdition Deployment

    2) Browser(s) and version(s) involved
    Using Google Chrome version Version 115.0.5790.171 (Official Build) (64-bit)

    3) Server-side problem logs
    Not having a server-side issue here, but here are the server-side logs when the datasource is created
    Code:
    === 2023-08-09 15:43:20,320 [c-22] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    === 2023-08-09 15:43:20,339 [izer] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 581 from Finalizer
    === 2023-08-09 15:43:20,340 [izer] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 576 from Finalizer
    === 2023-08-09 15:43:20,340 [izer] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 579 from Finalizer
    === 2023-08-09 15:43:20,340 [izer] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 580 from Finalizer
    === 2023-08-09 15:43:20,341 [izer] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 577 from Finalizer
    === 2023-08-09 15:43:20,346 [c-22] INFO SecureIDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36]
    === 2023-08-09 15:43:20,346 [c-22] INFO RPCRequest - Executing MainPage.canLaunchScreen
    === 2023-08-09 15:43:20,347 [c-22] INFO DataTools - While applying to java.lang.String, couldn't setProperties:
    {
        screenName:"No such property"
    }
    === 2023-08-09 15:43:20,347 [c-22] INFO Compression - /isomorphic/IDACall: 67 -> 73
    === 2023-08-09 15:43:20,414 [c-22] INFO RequestContext - URL: '/isomorphic/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    Generating Data Source=== 2023-08-09 15:43:20,420 [c-22] INFO Compression - /isomorphic/DataSourceLoader: 6.0k -> 2.0k
    === 2023-08-09 15:43:24,519 [c-22] INFO RequestContext - URL: '/isomorphic/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    === 2023-08-09 15:43:24,521 [c-22] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 527
    === 2023-08-09 15:43:24,522 [c-22] INFO Compression - /isomorphic/DataSourceLoader: 1.0k -> 549
    === 2023-08-09 15:43:25,668 [c-23] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    === 2023-08-09 15:43:25,671 [c-23] INFO SecureIDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36]
    === 2023-08-09 15:43:25,671 [c-23] INFO DSRequest - Executing Personalization.fetch rows: 0->-1 with
    criteria: {ScreenID:null}
    === 2023-08-09 15:43:25,672 [c-23] DEBUG SQLDataSource - 527: Executing SQL query on 'ProfitZoom': SELECT pzPersonalization.PersonalID, pzPersonalization.DomainKey, pzPersonalization.IdentityID, pzPersonalization.ScreenID, pzPersonalization.ComponentID, pzPersonalization.DataType, pzPersonalization.PersonalData FROM PUB.pzPersonalization WHERE (pzPersonalization.ScreenID IS NULL)
    === 2023-08-09 15:43:25,673 [c-23] DEBUG SQLConnectionManager - Borrowed connection '1723112378'
    === 2023-08-09 15:43:25,673 [c-23] DEBUG SQLTransaction - Started new ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:25,673 [c-23] DEBUG SQLDataSource - Setting DSRequest as being part of a transaction on connection 1723112378
    === 2023-08-09 15:43:25,673 [c-23] INFO SQLDriver - Executing SQL query on 'ProfitZoom' using connection '1723112378': SELECT pzPersonalization.PersonalID, pzPersonalization.DomainKey, pzPersonalization.IdentityID, pzPersonalization.ScreenID, pzPersonalization.ComponentID, pzPersonalization.DataType, pzPersonalization.PersonalData FROM PUB.pzPersonalization WHERE (pzPersonalization.ScreenID IS NULL)
    === 2023-08-09 15:43:25,675 [c-23] INFO DSResponse - DSResponse: List with 0 items
    === 2023-08-09 15:43:25,675 [c-23] DEBUG SQLTransaction - Committing ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:25,676 [c-23] DEBUG SQLTransaction - getConnection() looked for transactional connection for ProfitZoom: hashcode "1723112378"
    === 2023-08-09 15:43:25,676 [c-23] DEBUG SQLTransaction - Ending ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:25,676 [c-23] DEBUG SQLConnectionManager - About to close connection with hashcode "1723112378"
    === 2023-08-09 15:43:25,677 [c-23] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 527
    === 2023-08-09 15:43:25,677 [c-23] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 527
    === 2023-08-09 15:43:25,677 [c-23] INFO Compression - /isomorphic/IDACall: 188 -> 152
    === 2023-08-09 15:43:45,858 [c-22] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    Generating Data Source=== 2023-08-09 15:43:45,862 [c-22] INFO SecureIDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36]
    === 2023-08-09 15:43:45,862 [c-22] INFO DSRequest - Executing isc_RedstripeBaseGrid_0->ProfitZoom_UserProfile.fetch rows: 0->75 with
    criteria: {}
    Execute Fetch=== 2023-08-09 15:43:45,863 [c-22] DEBUG SQLDataSource - DataSource 583 acquired SQLDriver instance 651654070 during initialization
    === 2023-08-09 15:43:45,864 [c-22] DEBUG SQLDataSource - Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
    === 2023-08-09 15:43:45,864 [c-22] DEBUG SQLDataSource - Eval'd row count query: SELECT COUNT(*) FROM PUB.UserProfile WHERE ((LOWER(UserProfile.DomainKey)=LOWER('demo') AND UserProfile.DomainKey IS NOT NULL))
    === 2023-08-09 15:43:45,865 [c-22] DEBUG SQLConnectionManager - Borrowed connection '1723112378'
    === 2023-08-09 15:43:45,865 [c-22] DEBUG SQLTransaction - Started new ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:45,865 [c-22] DEBUG SQLDataSource - Setting DSRequest as being part of a transaction on connection 1723112378
    === 2023-08-09 15:43:45,865 [c-22] INFO SQLDriver - Executing SQL query on 'ProfitZoom' using connection '1723112378': SELECT COUNT(*) FROM PUB.UserProfile WHERE ((LOWER(UserProfile.DomainKey)=LOWER('demo') AND UserProfile.DomainKey IS NOT NULL))
    === 2023-08-09 15:43:45,868 [c-22] DEBUG SQLDataSource - JDBC driver windowed select rows 0->75, result size 75. Query: SELECT UserProfile.IdentityName, UserProfile.CreateDate, UserProfile.CreateBy, UserProfile.UpdateDate, UserProfile.UpdateBy, UserProfile.UDF2, UserProfile.UDF6, UserProfile.UDF7, UserProfile.UDF8, UserProfile.UDF9, UserProfile.UDF10, UserProfile.UDF11, UserProfile.LastName, UserProfile.IdentityID, UserProfile.DomainKey, UserProfile.FirstName, UserProfile.MiddleName, UserProfile.Salutation, UserProfile.PrinterName, UserProfile.PrinterQueue, UserProfile.UserGroup, UserProfile.EMail, UserProfile.PrintEnvironment, UserProfile.PrintOutput, UserProfile.UserStatus, UserProfile.PrintOutputViewFileSpreadsheet, UserProfile.UDF1, UserProfile.UDF3, UserProfile.UDF4, UserProfile.UDF5, UserProfile.TechID, UserProfile.UserType, UserProfile.MenuRoleName, UserProfile.IsMobileUser, UserProfile.IsAppUser, UserProfile.EmployeeID, UserProfile.HomepageKPI1, UserProfile.HomepageKPI2, UserProfile.HomepageKPI3, UserProfile.HomepageKPI4, UserProfile.HomepageKPI5, UserProfile.HomepageKPI6, UserProfile.UserName, UserProfile.Password, UserProfile.Active, UserProfile.UserFullName, UserProfile.PasswordSalt, UserProfile.DefaultDivID, UserProfile.FailedLoginAttempts, UserProfile.AccountLockoutEndTime, UserProfile.AccountLockoutCounterResetTime, UserProfile.ActivePortalCustomerCode, UserProfile.DefaultWarehouse FROM PUB.UserProfile WHERE ((LOWER(UserProfile.DomainKey)=LOWER('demo') AND UserProfile.DomainKey IS NOT NULL))
    === 2023-08-09 15:43:45,868 [c-22] DEBUG SQLDataSource - Setting DSRequest as being part of a transaction on connection 1723112378
    === 2023-08-09 15:43:45,872 [c-22] DEBUG SQLDataSource - Using paging strategy 'jdbcScroll' - scrolling to absolute position 1
    === 2023-08-09 15:43:45,873 [c-22] DEBUG SQLDataSource - Scrolling / positioning took 1ms
    === 2023-08-09 15:43:45,881 [c-22] INFO DSResponse - DSResponse: List with 75 items
    === 2023-08-09 15:43:45,882 [c-22] DEBUG SQLTransaction - Committing ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:45,897 [c-22] DEBUG SQLTransaction - getConnection() looked for transactional connection for ProfitZoom: hashcode "1723112378"
    === 2023-08-09 15:43:45,897 [c-22] DEBUG SQLTransaction - Ending ProfitZoom transaction "1723112378"
    === 2023-08-09 15:43:45,897 [c-22] DEBUG SQLConnectionManager - About to close connection with hashcode "1723112378"
    === 2023-08-09 15:43:45,898 [c-22] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 583
    === 2023-08-09 15:43:45,898 [c-22] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 583
    === 2023-08-09 15:43:45,900 [c-22] INFO Compression - /isomorphic/IDACall: 58.3k -> 5.0k
    4) Problem processing server response - N/A

    5) JavaScript error Stack Trace -N/A

    6) Example data source file being used to get data from the database:

    DataSource.ds.xml
    Code:
    "<DataSource ID=\"%s\" " +
    
    " serverType=\"sql\" " +
    
    " serverConstructor=\"PZ.datasource.DomainDataSource\" " +
    
    " schema=\"PUB\" " +
    
    " tableName=\"%s\" " +
    
    " autoDeriveSchema=\"true\">" +
    
    "</DataSource>";
    7) Bug - N/A

    Appreciate any help on this!

    #2
    Did you try just adding the field to the (and in the end all) ds.xml? That should work IMHO.

    If it’s really all DataSources and a lot of them and tiresome to do so you could also do this programmatically with a DynamicDSGenerator.

    Best regards
    Blama

    Comment


      #3
      Sounds like you are using Oracle (or maybe Informix). ROWID is what Oracle calls a "pseudo column" and is not returned in JDBC metadata, so will not be automatically picked up by autoDeriveSchema.

      Blama is correct that you can just add it as an explicitly declared field or set up a DynamicDSGenerator to do so. Or, you can use SQL Templating (https://smartclient.com/smartclient-...customQuerying) to add it more selectively.

      Note, if you are trying to use ROWID to implement efficient data paging, note that that is already built into the SmartClient Server (see for example https://smartclient.com/smartclient-...urce.sqlPaging).

      Also, if you use ROWID in queries where it is already being used by the framework for SQL paging, it's possible that your use of the pseudo-column would conflict with SmartClient's default use of it. We would have to know more about your use case to say.

      Comment


        #4
        Adding the fields to the data source ds xml was the solution!

        Thank you both!

        Comment

        Working...
        X