Announcement

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

    Accessing fmt messages in CustomSQL

    Hi,

    I have a DS XML file in which I have written a customSQL as shown below

    Code:
    SELECT 'HELLO', COL1, COL2 FROM TABLE_NAME
    The word HELLO is hard coded in the sql which is in english.
    But when I go to other language our users want it in other language. So I tried to use as below. For the Datasource Tag in ds xml file I have given it as

    Code:
    <DataSource ID="...." serverType="sql" tableName="...." dbName=".." xmlns:fmt="WEB-INF/">
    	<fmt:bundle basename="qa.gov.moi.erp.util.resources.messages" />
    
    
    <fields>
    .....
    </fields>
    
    <operationBindings>
    <operationBinding operationType="fetch">
      <customSQL><![CDATA[
           SELECT '<fmt:message key="Label.HELLO"/>', COL1, COL2 FROM TABLE_NAME
      ]]>   
      </customSQL>
    </operationBinding>
    </operationBindings>
    
    <DataSource>

    If I am trying to do it wrong, could you please let me know how to do it. Is there any other way of doing it.

    We are working on below environment:

    Version: Isomorphic SmartClient/SmartGWT Framework (SmartClient_v90p_2014-03-07_PowerEdition)

    Browser: IE9


    Thanks in Advance.
    Last edited by Abdulaziz A. ; 4 Jun 2014, 02:45.

    #2
    <fmt:message> tags aren't allowed within customSQL, as you've discovered. Instead, you could use dsRequest.addToTemplateContext() to make the value available as a Velocity substitution variables. See the documentation of this method for details.

    Comment


      #3
      I have done it in the below way..

      used $criteria.COL_NAME in the ds.xml files and in the corresponding serverobject class I have explicitly set the value in the dsRequest for that COL_NAME by fetching it from my locale specific messages and it started working.

      Thanks ... it worked :)

      Comment

      Working...
      X