Announcement

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

    Server Example – Inline Script

    Hi

    I followed the example Server Example – Inline Script

    When I validate the field “quantity”, how can I retrieve the value of other fields such as “instructions”.

    I tried
    record.instructions in groovy
    record.get("record.instructions ") in Java
    record.get("record.instructions ") in Javascript

    But none of them were work.

    In other words, how to refer to other field values when my validation involves two fields.


    Many thanks



    <DataSource ID="inlineScript_orderForm" serverType="sql">
    <fields>
    <field name="orderItem" type="sequence" primaryKey="true"/>
    <field name="itemId" foreignKey="StockItem.id"/>
    <field name="quantity" type="integer">
    <validators>
    <validator type="serverCustom">
    <serverCondition language="groovy"><![CDATA[
    value < dataSources.StockItem.fetchById(record.itemId).quantity
    ]]></serverCondition>

    <!-- serverCondition language="java"><![CDATA[
    DataSource ds = (DataSource) dataSources.get("StockItem");
    Map rec = ds.fetchById(record.get("itemId"));
    Integer quantity = (Integer) rec.get("quantity");
    return value < quantity;
    ]]></serverCondition -->

    <!-- serverCondition language="javascript"><![CDATA[
    value < dataSources.get("StockItem").fetchById(record.get("itemId")).get("quantity")
    ]]></serverCondition -->
    <errorMessage>Not enough in stock</errorMessage>
    </validator>
    </validators>
    </field>
    <field name="instructions" type="text"/>
    </fields>
    </DataSource>

    #2
    This use case is discussed right in the docs for serverCondition:

    Note that "record" will contain only other values submitted at the same time, not the complete DataSource record. For most types of cross-field validation, you should fetch the current saved record using the server-side API DataSource.fetchById(). For example, in Velocity:

    $dataSource.fetchById($record.primaryKeyField).otherFieldName

    Note that, while a DSRequest provides dsRequest.oldValues, these values cannot be relied upon for a security check since they could be faked.

    Comment


      #3
      Sorry, actually it looks like you're trying to do this. The problem is, you haven't posted any details about what's going wrong, as well as basics like what product and version you're using.

      See the FAQ for the details you need to post.

      Comment


        #4
        Hi

        For evaluation purpose, I am using "SmartClient_v91p_2014-07-18_Evaluation"

        I create a master detail relationship, two data sources are:

        The first datasource

        <DataSource
        schema="VTTPC"
        dbName="OracleDev"
        tableName="company"
        ID="company_where"
        dataSourceVersion="1"
        generatedBy="v9.1p_2014-07-18/EVAL Deployment 2014-07-18"
        serverType="sql"
        requiresAuthentication="true"
        >
        <fields>
        <field sqlType="decimal" sqlLength="6" name="COMPANYID" type="integer" primaryKey="true" canEdit="true" foreignKey="history3.COMPANYID" ></field>
        <field sqlType="varchar" sqlLength="100" name="COMPANY" length="100" type="text"></field>
        <field sqlType="decimal" sqlLength="8" name="PRICE" type="float"></field>
        <field sqlType="decimal" sqlLength="8" name="PCHANGE" type="float"></field>
        <field sqlType="decimal" sqlLength="8" name="PCTCHANGE" type="float"></field>
        <field sqlType="date" sqlLength="7" name="LASTCHANGE" type="date"></field>
        <field sqlType="varchar" sqlLength="10" name="ORDER_NO" length="10" type="text"></field>
        <field sqlType="varchar" sqlLength="5" name="CURRENCY_CODE" length="5" type="text"></field>
        <field sqlType="varchar" sqlLength="10" name="STATUS" length="10" type="text"></field>
        <field sqlType="varchar" sqlLength="20" name="PRINT_FLAG" length="20" type="boolean"></field>
        </fields>
        <operationBindings>
        <operationBinding operationType="fetch" requiresRole="tomcat" >
        <criteria fieldName="COMPANYID" value="$session.sCompID" operator="lessThan" />
        <criteria fieldName="COMPANYID" value="$session.sPKID" operator="greaterThan" />
        </operationBinding>
        <operationBinding operationType="add" requiresRole="tomcat" >
        </operationBinding>
        <operationBinding operationType="update" requiresRole="tomcat" >
        </operationBinding>
        <operationBinding operationType="remove" requiresRole="tomcat" >
        </operationBinding>
        </operationBindings>
        </DataSource>



        The second datasource

        <DataSource
        schema="VTTPC"
        testFileName="history3.data.xml"
        dbName="OracleDev"
        tableName="history3a"
        ID="history3a"
        dataSourceVersion="1"
        generatedBy="v9.1p_2014-07-18/EVAL Deployment 2014-07-18"
        serverType="sql"
        >
        <fields>
        <field sqlType="decimal" primaryKey="true" sqlLength="6" name="COMPANYID" type="integer" required="true" foreignKey="company.COMPANYID"></field>
        <field sqlType="decimal" primaryKey="true" sqlLength="6" name="LINENUM" type="integer" required="true"></field>
        <field sqlType="varchar" sqlLength="100" name="H_TEXT" length="100" type="text" foreignKey="Unit_meas_tab.UOM" ></field>
        <field sqlType="date" sqlLength="7" name="H_DATE" type="date"></field>
        <field sqlType="varchar" sqlLength="50" name="PART_NO" length="50" type="text"></field>
        <field sqlType="decimal" sqlLength="8" name="UNIT_PRICE" type="float">
        <validators>
        <validator type="serverCustom">
        <scriptImport>javax.servlet.http.*</scriptImport>
        <serverCondition language="groovy"><![CDATA[
        Boolean.parseBoolean(session.getAttribute("sCanUpdate"));
        ]]></serverCondition>
        <errorMessage>YOU HAVE NO ACCESS</errorMessage>
        </validator>

        <validator type="serverCustom">
        <serverCondition language="javascript"><![CDATA[
        value < 100
        ]]></serverCondition>
        <errorMessage>Price cannot be greater than 100</errorMessage>
        </validator>

        </validators>
        </field>
        <field sqlType="decimal" sqlLength="8" name="ORDER_QTY" type="float">
        <validators>
        <validator type="serverCustom">
        <serverCondition language="javascript"><![CDATA[
        value > record.get("UNIT_PRICE");
        ]]></serverCondition>
        <errorMessage>Quantity cannot be smaller than price..... </errorMessage>
        </validator>


        </validators>



        </field>
        </fields>
        <operationBindings>
        <operationBinding operationType="fetch" requiresRole="tomcat" >
        <criteria fieldName="COMPANYID" value="$session.sCompID" operator="lessThan" />
        <criteria fieldName="COMPANYID" value="$session.sPKID" operator="greaterThan" />
        </operationBinding>
        <operationBinding operationType="add" requiresRole="tomcat" >
        </operationBinding>
        <operationBinding operationType="update" requiresRole="tomcat" >
        </operationBinding>
        <operationBinding operationType="remove" requiresRole="tomcat" >
        </operationBinding>
        </operationBindings>

        </DataSource>


        I add a logic to check quantity cannot be smallest than price in the second datasource. But is does not work
        Please see the attached file

        This is the error log
        ---------------------------------------------------------------------------------------


        === 2014-10-03 09:23:41,629 [sor3] INFO Compression - /isomorphic/IDACall: 108765 -> 9665 bytes
        === 2014-10-03 09:24:14,665 [sor1] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: accept:*/*
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: accept-language:en-us
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8081/templates/comp..._118_where.jsp
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: host:localhost:8081
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: content-length:2068
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: connection:Keep-Alive
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - Header Name:Value pair: cookie:JSESSIONID=5BAAB756CBEF8043E5AB4D34765C7DBA; isc_cState=ready; IMyAppUser_DetailView_Main__Tabs=0; GLog=%7B%0D%20%20%20%20left%3A-4%2C%20%0D%20%20%20%20top%3A-1%2C%20%0D%20%20%20%20width%3A0%2C%20%0D%20%20%20%20height%3A0%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A4%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20trackRPC%3Anull%0D%7D
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - session exists: 5BAAB756CBEF8043E5AB4D34765C7DBA
        === 2014-10-03 09:24:14,666 [sor1] DEBUG IDACall - remote user: tomcat
        === 2014-10-03 09:24:14,736 [sor1] DEBUG XML - Parsed XML from (in memory stream): 19ms
        === 2014-10-03 09:24:14,739 [sor1] DEBUG RPCManager - Processing 1 requests.
        === 2014-10-03 09:24:14,740 [sor1] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        values:{
        H_DATE:new Date(1407196800000),
        LINENUM:5,
        UNIT_PRICE:16,
        ORDER_QTY:3.3,
        H_TEXT:"M",
        PART_NO:"92-003095-000-100",
        COMPANYID:2,
        Total:52.8,
        _selection_6:true
        },
        operationConfig:{
        dataSource:"history3a",
        operationType:"validate",
        textMatchStyle:"exact"
        },
        useStrictJSON:true,
        validationMode:"partial",
        appID:"builtinApplication",
        operation:"history3a_validate",
        oldValues:{
        H_DATE:new Date(1407196800000),
        LINENUM:5,
        UNIT_PRICE:16,
        ORDER_QTY:3.3,
        H_TEXT:"M",
        PART_NO:"92-003095-000-100",
        COMPANYID:2,
        Total:52.8,
        _selection_6:true
        },
        criteria:{
        }
        }
        === 2014-10-03 09:24:14,740 [sor1] INFO IDACall - Performing 1 operation(s)
        === 2014-10-03 09:24:14,740 [sor1] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
        === 2014-10-03 09:24:14,740 [sor1] DEBUG DeclarativeSecurity - DataSource history3a is not in the pre-checked list, processing...
        === 2014-10-03 09:24:14,740 [sor1] DEBUG AppBase - [builtinApplication.history3a_validate] No userTypes defined, allowing anyone access to all operations for this application
        === 2014-10-03 09:24:14,740 [sor1] DEBUG AppBase - [builtinApplication.history3a_validate] No public zero-argument method named '_history3a_validate' found, performing generic datasource operation
        === 2014-10-03 09:24:14,772 [sor1] DEBUG ValidationContext - [builtinApplication.history3a_validate] Adding validation errors at path '/history3a/ORDER_QTY/ORDER_QTY': {errorMessage=Quantity cannot be smaller than price..... }
        === 2014-10-03 09:24:14,773 [sor1] INFO Validation - [builtinApplication.history3a_validate] Validation error: [
        {
        ORDER_QTY:{
        errorMessage:"Quantity cannot be smaller than price..... "
        }
        }
        ]
        === 2014-10-03 09:24:14,773 [sor1] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
        === 2014-10-03 09:24:14,773 [sor1] DEBUG RPCManager - non-DMI response, dropExtraFields: false
        === 2014-10-03 09:24:14,773 [sor1] INFO Compression - /isomorphic/IDACall: 265 -> 213 bytes
        === 2014-10-03 09:24:29,184 [sor2] INFO Download - Returning 304: Not modified on conditional get of: C:\Tony - Framework\SmartClient_v91p_2014-07-18_Evaluation\smartclientSDK\isomorphic\system\helpers\Log.html
        === 2014-10-03 09:24:29,668 [sor3] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
        === 2014-10-03 09:24:29,669 [sor3] DEBUG IDACall - Header Name:Value pair: accept:*/*
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: accept-language:en-us
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8081/isomorphic/sys...lpers/Log.html
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: host:localhost:8081
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: content-length:677
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: connection:Keep-Alive
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - Header Name:Value pair: cookie:IMyAppUser_DetailView_Main__Tabs=0; GLog=%7B%0D%20%20%20%20left%3A-4%2C%20%0D%20%20%20%20top%3A-1%2C%20%0D%20%20%20%20width%3A0%2C%20%0D%20%20%20%20height%3A0%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A4%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20trackRPC%3Anull%0D%7D; JSESSIONID=5BAAB756CBEF8043E5AB4D34765C7DBA; isc_cState=ready
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - session exists: 5BAAB756CBEF8043E5AB4D34765C7DBA
        === 2014-10-03 09:24:29,670 [sor3] DEBUG IDACall - remote user: tomcat
        === 2014-10-03 09:24:29,699 [sor3] DEBUG XML - Parsed XML from (in memory stream): 3ms
        === 2014-10-03 09:24:29,701 [sor3] DEBUG RPCManager - Processing 1 requests.
        === 2014-10-03 09:24:29,701 [sor3] DEBUG RPCManager - Request #1 (RPCRequest) data: {
        appID:"isc_builtin",
        className:"builtin",
        methodName:"getAvailableScriptEngines",
        arguments:[
        ],
        is_ISC_RPC_DMI:true
        }
        === 2014-10-03 09:24:29,701 [sor3] INFO IDACall - Performing 1 operation(s)
        === 2014-10-03 09:24:29,702 [sor3] DEBUG RPCDMI - appConfig: isc.Application.create({
        rpcBindings:[
        {
        ID:"builtin",
        className:"com.isomorphic.rpc.BuiltinRPC",
        visibleMethods:[
        {
        name:"downloadWSDL"
        },
        {
        name:"downloadClientContent"
        },
        {
        name:"downloadClientExport"
        },
        {
        name:"xmlToJS"
        },
        {
        name:"uploadProgressCheck"
        },
        {
        name:"saveFile"
        },
        {
        name:"appendToFile"
        },
        {
        name:"loadFile"
        },
        {
        name:"deleteFile"
        },
        {
        name:"loadSharedXML"
        },
        {
        name:"saveSharedXML"
        },
        {
        name:"getAvailableScriptEngines"
        },
        {
        name:"devConsoleEvalServerScript"
        },
        {
        name:"evalJava"
        },
        {
        name:"getLogNames"
        },
        {
        name:"getLogEntries"
        },
        {
        name:"clearLogEntries"
        },
        {
        name:"getLogThresholds"
        },
        {
        name:"setLogThreshold"
        },
        {
        name:"setTemporaryLogThreshold"
        },
        {
        name:"revertTemporaryLogThresholds"
        },
        {
        name:"getPdfObject"
        },
        {
        name:"exportImage"
        },
        {
        name:"areServerTimingsTracked"
        },
        {
        name:"trackServerTimings"
        }
        ]
        },
        {
        ID:"builtin_tools",
        className:"com.isomorphic.tools.BuiltinRPC",
        visibleMethods:[
        {
        name:"getDataSourceFromTable"
        },
        {
        name:"getDataSourceJSONFromTable"
        },
        {
        name:"getDataSourceFromHibernateMapping"
        },
        {
        name:"getDataSourceJSONFromHibernateMapping"
        },
        {
        name:"getTables"
        },
        {
        name:"getFieldsFromTable"
        },
        {
        name:"getBeanFields"
        },
        {
        name:"getHibernateBeans"
        },
        {
        name:"getDatabaseProductNameAndVersion"
        },
        {
        name:"getDatabaseTableTypes"
        },
        {
        name:"setAttributes"
        },
        {
        name:"clearAttributes"
        },
        {
        name:"getAttributes"
        },
        {
        name:"getAttribute"
        },
        {
        name:"getDataSourceConfigFromJavaClass"
        },
        {
        args:"cName",
        language:"groovy",
        name:"getJavaSource",
        script:"\n if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\"); \n //import org.apache.bcel.Repository;\n\n try {\n return org.apache.bcel.Repository.lookupClass(cName).toString();\n } catch (Throwable e) {\n return \"Unable to reverse engineer class \"+cName+\": \"+e.getMessage();\n }\n "
        },
        {
        name:"loadDataSource"
        },
        {
        name:"dsFromXML"
        },
        {
        name:"dsConfigFromXML"
        },
        {
        name:"getDefinedDataSources"
        }
        ]
        },
        {
        ID:"builtin_adminconsole",
        className:"com.isomorphic.tools.AdminConsole",
        visibleMethods:[
        {
        name:"getDefinedDatabases"
        },
        {
        name:"testDB"
        },
        {
        name:"saveDBConfig"
        },
        {
        name:"setDefaultDB"
        },
        {
        name:"importDataSources"
        },
        {
        name:"discoverJNDIDatabases"
        }
        ]
        }
        ]
        })

        === 2014-10-03 09:24:29,703 [sor3] DEBUG RPCDMI - rpc returned data
        === 2014-10-03 09:24:29,704 [sor3] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
        === 2014-10-03 09:24:29,704 [sor3] INFO Compression - /isomorphic/IDACall: 108 -> 108 bytes
        === 2014-10-03 09:24:36,043 [sor2] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
        === 2014-10-03 09:24:36,117 [sor2] INFO Compression - /isomorphic/IDACall: 81 -> 86 bytes
        === 2014-10-03 09:24:36,135 [sor3] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
        Attached Files

        Comment


          #5
          Correct JavaScript syntax would be just record.UNIT_PRICE (no call to get()).

          Comment


            #6
            Hi

            I follow your instruction and change to record.UNIT_PRICE.
            But when I change the quantity, it always display "Quantity cannot be smaller than price..... " regressless of what price and quantity I inputed.

            The server log is



            === 2014-10-06 02:04:00,306 [sor3] INFO Compression - /isomorphic/IDACall: 103591 -> 7978 bytes
            === 2014-10-06 02:04:26,646 [sor8] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0': Moz (Gecko) with Accept-Encoding header
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: host:localhost:8081
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: accept-language:en-US,en;q=0.5
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8081/templates/component_databinding_027_118_where.jsp
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: content-length:1980
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: cookie:JSESSIONID=298467DDC543233A65D0C6F037DEB24D; isc_cState=ready
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: connection:keep-alive
            === 2014-10-06 02:04:26,647 [sor8] DEBUG IDACall - Header Name:Value pair: pragma:no-cache
            === 2014-10-06 02:04:26,648 [sor8] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache
            === 2014-10-06 02:04:26,648 [sor8] DEBUG IDACall - session exists: 298467DDC543233A65D0C6F037DEB24D
            === 2014-10-06 02:04:26,648 [sor8] DEBUG IDACall - remote user: tomcat
            === 2014-10-06 02:04:26,650 [sor8] DEBUG XML - Parsed XML from (in memory stream): 2ms
            === 2014-10-06 02:04:26,653 [sor8] DEBUG RPCManager - Processing 1 requests.
            === 2014-10-06 02:04:26,654 [sor8] DEBUG RPCManager - Request #1 (DSRequest) payload: {
            values:{
            H_DATE:new Date(1406937600000),
            LINENUM:11,
            UNIT_PRICE:3,
            ORDER_QTY:1,
            H_TEXT:"PCS",
            PART_NO:"92-003095-000-100",
            COMPANYID:3,
            Total:3,
            _selection_10:true
            },
            operationConfig:{
            dataSource:"history3a",
            operationType:"validate",
            textMatchStyle:"exact"
            },
            validationMode:"partial",
            appID:"builtinApplication",
            operation:"history3a_validate",
            oldValues:{
            H_DATE:new Date(1406937600000),
            LINENUM:11,
            UNIT_PRICE:3,
            ORDER_QTY:1,
            H_TEXT:"PCS",
            PART_NO:"92-003095-000-100",
            COMPANYID:3,
            Total:3,
            _selection_10:true
            },
            criteria:{
            }
            }
            === 2014-10-06 02:04:26,654 [sor8] INFO IDACall - Performing 1 operation(s)
            === 2014-10-06 02:04:26,654 [sor8] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
            === 2014-10-06 02:04:26,654 [sor8] DEBUG DeclarativeSecurity - DataSource history3a is not in the pre-checked list, processing...
            === 2014-10-06 02:04:26,654 [sor8] DEBUG AppBase - [builtinApplication.history3a_validate] No userTypes defined, allowing anyone access to all operations for this application
            === 2014-10-06 02:04:26,654 [sor8] DEBUG AppBase - [builtinApplication.history3a_validate] No public zero-argument method named '_history3a_validate' found, performing generic datasource operation
            === 2014-10-06 02:04:26,693 [sor8] DEBUG ValidationContext - [builtinApplication.history3a_validate] Adding validation errors at path '/history3a/ORDER_QTY/ORDER_QTY': {errorMessage=Quantity cannot be smaller than price..... }
            === 2014-10-06 02:04:26,694 [sor8] INFO Validation - [builtinApplication.history3a_validate] Validation error: [
            {
            ORDER_QTY:{
            errorMessage:"Quantity cannot be smaller than price..... "
            }
            }
            ]
            === 2014-10-06 02:04:26,694 [sor8] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2014-10-06 02:04:26,694 [sor8] DEBUG RPCManager - non-DMI response, dropExtraFields: false
            === 2014-10-06 02:04:26,695 [sor8] INFO Compression - /isomorphic/IDACall: 245 -> 202 bytes
            === 2014-10-06 02:04:40,806 [sor8] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0': Moz (Gecko) with Accept-Encoding header
            === 2014-10-06 02:04:40,847 [sor8] DEBUG IDACall - Header Name:Value pair: host:localhost:8081
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: accept-language:en-US,en;q=0.5
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8081/templates/component_databinding_027_118_where.jsp
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: content-length:1982
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: cookie:JSESSIONID=298467DDC543233A65D0C6F037DEB24D; isc_cState=ready
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: connection:keep-alive
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: pragma:no-cache
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - session exists: 298467DDC543233A65D0C6F037DEB24D
            === 2014-10-06 02:04:40,848 [sor8] DEBUG IDACall - remote user: tomcat
            === 2014-10-06 02:04:40,850 [sor8] DEBUG XML - Parsed XML from (in memory stream): 1ms
            === 2014-10-06 02:04:40,852 [sor8] DEBUG RPCManager - Processing 1 requests.
            === 2014-10-06 02:04:40,853 [sor8] DEBUG RPCManager - Request #1 (DSRequest) payload: {
            values:{
            H_DATE:new Date(1407456000000),
            LINENUM:13,
            UNIT_PRICE:2,
            ORDER_QTY:5,
            H_TEXT:"PCS",
            PART_NO:"30-023765-199-000",
            COMPANYID:3,
            Total:10,
            _selection_10:true
            },
            operationConfig:{
            dataSource:"history3a",
            operationType:"validate",
            textMatchStyle:"exact"
            },
            validationMode:"partial",
            appID:"builtinApplication",
            operation:"history3a_validate",
            oldValues:{
            H_DATE:new Date(1407456000000),
            LINENUM:13,
            UNIT_PRICE:2,
            ORDER_QTY:5,
            H_TEXT:"PCS",
            PART_NO:"30-023765-199-000",
            COMPANYID:3,
            Total:10,
            _selection_10:true
            },
            criteria:{
            }
            }
            === 2014-10-06 02:04:40,853 [sor8] INFO IDACall - Performing 1 operation(s)
            === 2014-10-06 02:04:40,853 [sor8] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
            === 2014-10-06 02:04:40,853 [sor8] DEBUG DeclarativeSecurity - DataSource history3a is not in the pre-checked list, processing...
            === 2014-10-06 02:04:40,853 [sor8] DEBUG AppBase - [builtinApplication.history3a_validate] No userTypes defined, allowing anyone access to all operations for this application
            === 2014-10-06 02:04:40,853 [sor8] DEBUG AppBase - [builtinApplication.history3a_validate] No public zero-argument method named '_history3a_validate' found, performing generic datasource operation
            === 2014-10-06 02:04:40,955 [sor8] DEBUG ValidationContext - [builtinApplication.history3a_validate] Adding validation errors at path '/history3a/ORDER_QTY/ORDER_QTY': {errorMessage=Quantity cannot be smaller than price..... }
            === 2014-10-06 02:04:40,955 [sor8] INFO Validation - [builtinApplication.history3a_validate] Validation error: [
            {
            ORDER_QTY:{
            errorMessage:"Quantity cannot be smaller than price..... "
            }
            }
            ]
            === 2014-10-06 02:04:40,955 [sor8] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2014-10-06 02:04:40,956 [sor8] DEBUG RPCManager - non-DMI response, dropExtraFields: false
            === 2014-10-06 02:04:40,956 [sor8] INFO Compression - /isomorphic/IDACall: 245 -> 202 bytes
            === 2014-10-06 02:04:51,957 [sor5] INFO Download - Returning 304: Not modified on conditional get of: C:\Tony - Framework\SmartClient_v91p_2014-07-18_Evaluation\smartclientSDK\isomorphic\system\helpers\Log.html
            === 2014-10-06 02:04:52,477 [sor3] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
            === 2014-10-06 02:04:52,478 [sor3] DEBUG IDACall - Header Name:Value pair: accept:*/*
            === 2014-10-06 02:04:52,484 [sor3] DEBUG IDACall - Header Name:Value pair: accept-language:en-us
            === 2014-10-06 02:04:52,484 [sor3] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8081/isomorphic/system/helpers/Log.html
            === 2014-10-06 02:04:52,484 [sor3] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8
            === 2014-10-06 02:04:52,484 [sor3] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
            === 2014-10-06 02:04:52,484 [sor3] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
            === 2014-10-06 02:04:52,486 [sor3] DEBUG IDACall - Header Name:Value pair: host:localhost:8081
            === 2014-10-06 02:04:52,486 [sor3] DEBUG IDACall - Header Name:Value pair: content-length:677
            === 2014-10-06 02:04:52,486 [sor3] DEBUG IDACall - Header Name:Value pair: connection:Keep-Alive
            === 2014-10-06 02:04:52,486 [sor3] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache
            === 2014-10-06 02:04:52,486 [sor3] DEBUG IDACall - Header Name:Value pair: cookie:IMyAppUser_DetailView_Main__Tabs=0; GLog=%7B%0D%20%20%20%20left%3A-4%2C%20%0D%20%20%20%20top%3A-1%2C%20%0D%20%20%20%20width%3A0%2C%20%0D%20%20%20%20height%3A0%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A4%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20trackRPC%3Anull%0D%7D; JSESSIONID=7B8FF9094B2DB248BF1FDDA362873614; isc_cState=ready
            === 2014-10-06 02:04:52,487 [sor3] DEBUG IDACall - session exists: 7B8FF9094B2DB248BF1FDDA362873614
            === 2014-10-06 02:04:52,487 [sor3] DEBUG IDACall - remote user: null
            === 2014-10-06 02:04:52,523 [sor3] DEBUG XML - Parsed XML from (in memory stream): 4ms
            === 2014-10-06 02:04:52,525 [sor3] DEBUG RPCManager - Processing 1 requests.
            === 2014-10-06 02:04:52,525 [sor3] DEBUG RPCManager - Request #1 (RPCRequest) data: {
            appID:"isc_builtin",
            className:"builtin",
            methodName:"getAvailableScriptEngines",
            arguments:[
            ],
            is_ISC_RPC_DMI:true
            }
            === 2014-10-06 02:04:52,526 [sor3] INFO IDACall - Performing 1 operation(s)
            === 2014-10-06 02:04:52,528 [sor3] DEBUG RPCDMI - appConfig: isc.Application.create({
            rpcBindings:[
            {
            ID:"builtin",
            className:"com.isomorphic.rpc.BuiltinRPC",
            visibleMethods:[
            {
            name:"downloadWSDL"
            },
            {
            name:"downloadClientContent"
            },
            {
            name:"downloadClientExport"
            },
            {
            name:"xmlToJS"
            },
            {
            name:"uploadProgressCheck"
            },
            {
            name:"saveFile"
            },
            {
            name:"appendToFile"
            },
            {
            name:"loadFile"
            },
            {
            name:"deleteFile"
            },
            {
            name:"loadSharedXML"
            },
            {
            name:"saveSharedXML"
            },
            {
            name:"getAvailableScriptEngines"
            },
            {
            name:"devConsoleEvalServerScript"
            },
            {
            name:"evalJava"
            },
            {
            name:"getLogNames"
            },
            {
            name:"getLogEntries"
            },
            {
            name:"clearLogEntries"
            },
            {
            name:"getLogThresholds"
            },
            {
            name:"setLogThreshold"
            },
            {
            name:"setTemporaryLogThreshold"
            },
            {
            name:"revertTemporaryLogThresholds"
            },
            {
            name:"getPdfObject"
            },
            {
            name:"exportImage"
            },
            {
            name:"areServerTimingsTracked"
            },
            {
            name:"trackServerTimings"
            }
            ]
            },
            {
            ID:"builtin_tools",
            className:"com.isomorphic.tools.BuiltinRPC",
            visibleMethods:[
            {
            name:"getDataSourceFromTable"
            },
            {
            name:"getDataSourceJSONFromTable"
            },
            {
            name:"getDataSourceFromHibernateMapping"
            },
            {
            name:"getDataSourceJSONFromHibernateMapping"
            },
            {
            name:"getTables"
            },
            {
            name:"getFieldsFromTable"
            },
            {
            name:"getBeanFields"
            },
            {
            name:"getHibernateBeans"
            },
            {
            name:"getDatabaseProductNameAndVersion"
            },
            {
            name:"getDatabaseTableTypes"
            },
            {
            name:"setAttributes"
            },
            {
            name:"clearAttributes"
            },
            {
            name:"getAttributes"
            },
            {
            name:"getAttribute"
            },
            {
            name:"getDataSourceConfigFromJavaClass"
            },
            {
            args:"cName",
            language:"groovy",
            name:"getJavaSource",
            script:"\n if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\"); \n //import org.apache.bcel.Repository;\n\n try {\n return org.apache.bcel.Repository.lookupClass(cName).toString();\n } catch (Throwable e) {\n return \"Unable to reverse engineer class \"+cName+\": \"+e.getMessage();\n }\n "
            },
            {
            name:"loadDataSource"
            },
            {
            name:"dsFromXML"
            },
            {
            name:"dsConfigFromXML"
            },
            {
            name:"getDefinedDataSources"
            }
            ]
            },
            {
            ID:"builtin_adminconsole",
            className:"com.isomorphic.tools.AdminConsole",
            visibleMethods:[
            {
            name:"getDefinedDatabases"
            },
            {
            name:"testDB"
            },
            {
            name:"saveDBConfig"
            },
            {
            name:"setDefaultDB"
            },
            {
            name:"importDataSources"
            },
            {
            name:"discoverJNDIDatabases"
            }
            ]
            }
            ]
            })

            === 2014-10-06 02:04:52,530 [sor3] DEBUG RPCDMI - rpc returned data
            === 2014-10-06 02:04:52,530 [sor3] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2014-10-06 02:04:52,530 [sor3] INFO Compression - /isomorphic/IDACall: 108 -> 108 bytes
            === 2014-10-06 02:04:55,011 [sor5] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS
            === 2014-10-06 02:04:55,094 [sor5] INFO Compression - /isomorphic/IDACall: 81 -> 86 bytes
            === 2014-10-06 02:04:55,138 [sor3] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)': MSIE with Accept-Encoding header, ready for compressed JS


            Please advise

            Many thanks

            Comment


              #7
              You need to actually post your revised code.

              Comment


                #8
                This is the revised code

                <DataSource
                schema="VTTPC"
                testFileName="history3.data.xml"
                dbName="OracleDev"
                tableName="history3a"
                ID="history3a"
                dataSourceVersion="1"
                generatedBy="v9.1p_2014-07-18/EVAL Deployment 2014-07-18"
                serverType="sql"
                >
                <fields>
                <field sqlType="decimal" primaryKey="true" sqlLength="6" name="COMPANYID" type="integer" required="true" foreignKey="company.COMPANYID"></field>
                <field sqlType="decimal" primaryKey="true" sqlLength="6" name="LINENUM" type="integer" required="true"></field>
                <field sqlType="varchar" sqlLength="100" name="H_TEXT" length="100" type="text" foreignKey="Unit_meas_tab.UOM" ></field>
                <field sqlType="date" sqlLength="7" name="H_DATE" type="date"></field>
                <field sqlType="varchar" sqlLength="50" name="PART_NO" length="50" type="text"></field>
                <field sqlType="decimal" sqlLength="8" name="UNIT_PRICE" type="float">
                <validators>
                <validator type="serverCustom">
                <scriptImport>javax.servlet.http.*</scriptImport>
                <serverCondition language="groovy"><![CDATA[
                Boolean.parseBoolean(session.getAttribute("sCanUpdate"));
                ]]></serverCondition>
                <errorMessage>YOU HAVE NO ACCESS</errorMessage>
                </validator>

                <validator type="serverCustom">
                <serverCondition language="javascript"><![CDATA[
                value < 100
                ]]></serverCondition>
                <errorMessage>Price cannot be greater than 100</errorMessage>
                </validator>

                </validators>
                </field>
                <field sqlType="decimal" sqlLength="8" name="ORDER_QTY" type="float">
                <validators>
                <validator type="serverCustom">
                <serverCondition language="javascript"><![CDATA[
                value > record.UNIT_PRICE;
                ]]></serverCondition>
                <errorMessage>Quantity cannot be smaller than price..... </errorMessage>
                </validator>


                </validators>



                </field>
                </fields>
                <operationBindings>
                <operationBinding operationType="fetch" requiresRole="tomcat" >
                <criteria fieldName="COMPANYID" value="$session.sCompID" operator="lessThan" />
                <criteria fieldName="COMPANYID" value="$session.sPKID" operator="greaterThan" />
                </operationBinding>
                <operationBinding operationType="add" requiresRole="tomcat" >
                </operationBinding>
                <operationBinding operationType="update" requiresRole="tomcat" >
                </operationBinding>
                <operationBinding operationType="remove" requiresRole="tomcat" >
                </operationBinding>
                </operationBindings>

                </DataSource>

                Please advise

                Comment


                  #9
                  Your last revision is:
                  Code:
                  <validator type="serverCustom">
                  <serverCondition language="javascript"><![CDATA[
                  value > record.UNIT_PRICE;
                  ]]></serverCondition>
                  <errorMessage>Quantity cannot be smaller than price..... </errorMessage>
                  </validator>
                  Accordingly to what was said earlier, could you change it as following:
                  Code:
                  <validator type="serverCustom">
                  <serverCondition language="javascript"><![CDATA[
                  [b][i]value > dataSource.fetchById(record.itemId).UNIT_PRICE;[/i][/b]
                  ]]></serverCondition>
                  <errorMessage>Quantity cannot be smaller than price..... </errorMessage>
                  </validator>

                  Comment

                  Working...
                  X