Announcement

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

    customValueFields are ignored in update operation

    SmartClient Version: v10.1p_2016-02-02/Enterprise Deployment (built 2016-02-02)
    Hello, in a SQLDataSource I have a field defined as:

    Code:
    <field name="WP_NOTE" type="text" customSQL="true"/>
    which is fetched with an operationBinding defined as:
    Code:
           
    <operationBinding operationType="fetch" operationId="fetchModalitaConsegnaWP"
                              outputs="WP_NOTE,ID_REC"
                              customFields="WP_NOTE">
           ...
    (ID_REC is the primaryKey)
    The WP_NOTE field is correctly retrieved and sent to client.
    Then I have an 'update' operationBinding:

    Code:
    <operationBinding operationType="update" operationId="updateModalitaConsegnaWP" cacheSyncOperation="fetchModalitaConsegnaWP"
                                      customValueFields="WP_NOTE">
    </operationBinding>
    but when I save my form, I see an update operation without the WP_NOTE field:

    Code:
    2016-02-02 17:38:29,595 DEBUG RPCManager Request #1 (DSRequest) payload: {
        criteria:{
            ID_REC:918569
        },
        values:{
            ID_REC:918569,
            WP_NOTE:"test"
        },
        operationConfig:{
            dataSource:"JPC_CONTRATTI",
            repo:null,
            operationType:"update",
            textMatchStyle:"exact"
        },
        componentId:"modalitaConsegnaWpForm",
        appID:"builtinApplication",
        operation:"updateModalitaConsegnaWP",
        oldValues:{
            ID_REC:918569
        }
    } 
    2016-02-02 17:38:29,595 INFO  IDACall Performing 1 operation(s) 
    2016-02-02 17:38:29,595 DEBUG DeclarativeSecurity Processing security checks for DataSource null, field null 
    2016-02-02 17:38:29,595 DEBUG DeclarativeSecurity DataSource JPC_CONTRATTI is not in the pre-checked list, processing... 
    2016-02-02 17:38:29,595 DEBUG AppBase [builtinApplication.updateModalitaConsegnaWP] No userTypes defined, allowing anyone access to all operations for this application 
    2016-02-02 17:38:29,595 DEBUG AppBase [builtinApplication.updateModalitaConsegnaWP] No public zero-argument method named '_updateModalitaConsegnaWP' found, performing generic datasource operation 
    2016-02-02 17:38:29,595 DEBUG BasicDataSource [builtinApplication.updateModalitaConsegnaWP] Validating 1 'JPC_CONTRATTI's at path '' 
    2016-02-02 17:38:29,595 DEBUG BasicDataSource [builtinApplication.updateModalitaConsegnaWP] Validating a 'JPC_CONTRATTI' at path '' 
    2016-02-02 17:38:29,597 DEBUG BasicDataSource [builtinApplication.updateModalitaConsegnaWP] for field: ACCOUNT_MODadding automatically generated lengthRange validator for length:60 
    2016-02-02 17:38:29,597 DEBUG BasicDataSource [builtinApplication.updateModalitaConsegnaWP] Done validating 1 'JPC_CONTRATTI's at path '': 2ms (avg 2) 
    2016-02-02 17:38:29,597 DEBUG DataSource [builtinApplication.updateModalitaConsegnaWP] post-validation valueSet: [
        {
            ID_REC:918569,
            WP_NOTE:"test",
            DATE_MOD:new Date(1454431109595),
            ACCOUNT_MOD:"cbosticco"
        }
    ] 
    2016-02-02 17:38:29,598 INFO  SQLDataSource [builtinApplication.updateModalitaConsegnaWP] Performing update operation with
        criteria: {ID_REC:918569}    values: {ID_REC:918569,WP_NOTE:"test",DATE_MOD:new Date(1454431109595),ACCOUNT_MOD:"cbosticco"} 
    2016-02-02 17:38:29,599 DEBUG PoolableSQLConnectionFactory [builtinApplication.updateModalitaConsegnaWP] makeObject() created an unpooled Connection '1769088946' 
    2016-02-02 17:38:29,599 DEBUG SQLConnectionManager [builtinApplication.updateModalitaConsegnaWP] Borrowed connection '1769088946' 
    2016-02-02 17:38:29,599 DEBUG SQLTransaction [builtinApplication.updateModalitaConsegnaWP] Started new dbJpcEP transaction "1769088946" 
    2016-02-02 17:38:29,599 DEBUG SQLDataSource [builtinApplication.updateModalitaConsegnaWP] Setting DSRequest as being part of a transaction 
    2016-02-02 17:38:29,600 INFO  SQLDriver [builtinApplication.updateModalitaConsegnaWP] Executing SQL query on 'dbJpcEP' using connection '1769088946': UPDATE DBSALES.JPC_CONTRATTI SET ACCOUNT_MOD='cbosticco', DATE_MOD=TO_DATE('2016-02-02 17:38:29','YYYY-MM-DD HH24:MI:SS') WHERE (JPC_CONTRATTI.ID_REC=918569)
    is it a bug, or am I missing something?

    #2
    There's not currently a way to cause a customSQL="true" field to be used in the VALUES clause (and the docs also don't say that customValueFields or customFields would do this).

    What probably makes more sense is to *not* set your field to customSQL="true", and just specialize the different fetch queries so that the field is not used in the WHERE clause (excludeCriteriaFields), if that works for your use case.

    Comment


      #3
      Thanks for the clarification. Actually I need the field for a single update operationBinding so I've used velocity like this:
      Code:
                          <valuesClause>
                              WP_NOTE=#if($values.WP_NOTE) $values.WP_NOTE #else null #end,
                              $defaultValuesClause
                          </valuesClause>

      Comment

      Working...
      X