Announcement

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

    customUpdateExpression is ignored ?

    SmartClient 8.0
    I'm having an issue with customUpdateExpression: insert and updates of others colums are correct, but the date field field is ignored.
    Here's a simple test case:
    Code:
    <DataSource schema="DBINVITI" dbName="dbinviti" tableName="GRUPPI_STAMPA" ID="GRUPPI_STAMPA" serverType="sql">
    	<fields>
    		<field primaryKey="true" name="ID_GRUPPO" type="number"></field>
    		<field name="TITOLO" length="255" type="text"></field>
    		<field name="DESCRIZIONE" length="256" type="text"></field>
    		<field name="DATA_AGGIORNAMENTO" type="date">
    			<customUpdateExpression>$currentDate</customUpdateExpression>
    		</field>
    	</fields>
    </DataSource>
    Code:
    <%@ page contentType="text/html; charset=UTF-8"%>
    <%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %>
    <HTML><HEAD><TITLE>isc_test</TITLE>
    <isomorphic:loadISC skin="Graphite"/>
    </HEAD><BODY>
    <SCRIPT>
    isc.Page.setAppImgDir("../graphics/");
    <isomorphic:XML>
    
    <DataSource>
        <loadID>GRUPPI_STAMPA</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="GRUPPI_STAMPA" ID="ListGrid0" autoDraw="false">
        <fields>
            <ListGridField name="ID_GRUPPO" title="Id Gruppo"/>
            <ListGridField name="TITOLO" title="Titolo"/>
            <ListGridField name="DESCRIZIONE" title="Descrizione"/>
            <ListGridField name="DATA_AGGIORNAMENTO" title="Data Aggiornamento"/>
        </fields>
        <listEndEditAction>next</listEndEditAction>
        <showFilterEditor>true</showFilterEditor>
        <canEdit>true</canEdit>
        <autoFetchData>true</autoFetchData>
        <canRemoveRecords>true</canRemoveRecords>
        <xsi:type>ListGrid</xsi:type>
    </ListGrid>
    
    
    <DataView ID="DataView0" overflow="hidden" autoDraw="true">
        <members><Canvas ref="ListGrid0"/>
        </members>
        <width>100%</width>
        <height>100%</height>
    </DataView>
    
    
    </isomorphic:XML></SCRIPT>
    </BODY></HTML>
    oracle table:
    Code:
    CREATE TABLE GRUPPI_STAMPA 
    (
      ID_GRUPPO NUMBER NOT NULL 
    , TITOLO VARCHAR2(255 BYTE) 
    , DESCRIZIONE VARCHAR2(256 BYTE) 
    , DATA_AGGIORNAMENTO DATE 
    , CONSTRAINT GRUPPI_STAMPA_PK PRIMARY KEY 
      (
        ID_GRUPPO 
      )
      ENABLE 
    ) 
    LOGGING 
    TABLESPACE "DBINVITI" 
    PCTFREE 10 
    INITRANS 1 
    STORAGE 
    ( 
      INITIAL 65536 
      MINEXTENTS 1 
      MAXEXTENTS 2147483645 
      BUFFER_POOL DEFAULT 
    );

    #2
    as a workaround, I've tried:
    Code:
    <operationBindings> 
    <operationBinding operationType="update">
    <valuesClause>DATA_AGGIORNAMENTO = $currentDate, $defaultValuesClause</valuesClause>
    </operationBinding>
    </operationBindings>
    and this way I get a correct update, but the date does not get inserted, and I can't compose a similar valuesClause for an "add" operationType

    Comment


      #3
      The right way to do this is:

      Code:
      <operationBindings> 
      <operationBinding operationType="update">
      <values fieldName="DATA_AGGIORNAMENTO" value="$currentDate"/>
      </operationBinding>
      </operationBindings>

      Comment


        #4
        it's only updating....still no insert of the date column.

        BTW, what about customUpdateExpression ?

        Comment


          #5
          customUpdate/InsertExpression doesn't make sense for this use case, use <values>. It applies to both update and add.

          Comment


            #6
            Ok, now I understand I must repeat the binding also for the add operation.

            <operationBindings>
            <operationBinding operationType="add">
            <values fieldName="DATA_AGGIORNAMENTO" value="$currentDate"/>
            </operationBinding>
            <operationBinding operationType="update">
            <values fieldName="DATA_AGGIORNAMENTO" value="$currentDate"/>
            </operationBinding>
            </operationBindings>

            Now it works, thank you very much.

            I'm learning the powerful features of the SqlDs Power edition, it will be nice to have more samples.

            For instance, I don't understand why customUpdateExpression doesn't works in this use case.

            Comment


              #7
              It does work in this case, but you would have to use quotes and you'd have to format the date value, so it's not the easiest approach, <values> is better.

              Comment

              Working...
              X