Announcement

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

    how to create a DataSource file using customSQL

    hello,
    I want to do a join of 3 tables using a "customSQL" ,Could you give me the right syntax please ?
    my application does not start even with this mistake!

    here is my code:
    Code:
     
    
    <DataSource 
          dbName="SQLServer_CRM"
          dataSourceVersion="1"
          serverType="sql"
    >
    
                 <fields>
                      <field name="OBJ_ID" type="int" title="OBJ ID" customSQL="true">
                           <nativeName>crm_obj_idnum</nativeName>
                          <tableName>crm_objects</tableName>
                      </field>
    
                </fields> 
               <operationBindings>
               <operationBindings operationType="fetch">
                    <customSQL>
    
            SELECT  OBJ_DET.[crm_obj_idnum]             AS OBJ_ID
            ,OBJ_DET.[crm_obj_kind]                          AS OBJ_KIND
            ,OBJ_KN.[crm_kind_name]                         AS OBJ_KIND_NAME      
            ,OBJ_FATHER.crm_obj_name                     AS FATHER_NAME
            ,OBJ_DET.[crm_obj_parent_idnum]             AS FATHER_ID
            ,OBJ_DET.[crm_obj_name]                        AS OBJ_NAME
            ,OBJ_DET.[crm_obj_desc]                         AS OBJ_DESC
            ,OBJ_DET.[crm_obj_isactive]                     AS OBJ_ACTIVE
            fROM 
                [foveaprocess_easycrm].[dbo].[crm_objects]             OBJ_DET,
                [foveaprocess_easycrm].[dbo].[crm_objects]             OBJ_FATHER,
                [foveaprocess_easycrm].[dbo].[crm_kind]                  OBJ_KN
            WHERE 
            OBJ_DET.crm_obj_parent_idnum=OBJ_FATHER.crm_obj_idnum
            AND OBJ_DET.crm_obj_kind = OBJ_KN.crm_kind_idnum
            UNION ALL
            SELECT 
              [crm_attrdat_fk_obj_idnum]                        AS OBJ_ID
              ,OBJ_FATHER_DATA.crm_obj_kind                AS OBJ_KIND
              ,OBJ_KN.[crm_kind_name]                          AS OBJ_KIND_NAME
              ,OBJ_FATHER_DATA.crm_obj_name              AS FATHER_NAME
              ,[crm_attrdat_fk_obj_idnum]                      AS FATHER_ID
       ,case OBJ_ATTR_DATA.crm_attr_datatype WHEN 'A' THEN [crm_attrdat_data_A1] END AS OBJ_NAME
          ,OBJ_ATTR_DATA.crm_attr_name                  AS OBJ_DESC
          ,[crm_attrdat_isactive]                               AS OBJ_ACTIVE
         FROM 
                [foveaprocess_easycrm].[dbo].[crm_attrdata]           OBJ_DATA,
                [foveaprocess_easycrm].[dbo].[crm_attributs]          OBJ_ATTR_DATA,
                [foveaprocess_easycrm].[dbo].[crm_objects]            OBJ_FATHER_DATA,
                [foveaprocess_easycrm].[dbo].[crm_kind]                OBJ_KN
    
         WHERE 
               OBJ_DATA.crm_attrdat_fk_attr_idnum=OBJ_ATTR_DATA.crm_attr_idnum
               AND OBJ_DATA.crm_attrdat_fk_obj_idnum=OBJ_FATHER_DATA.crm_obj_idnum
               AND OBJ_ATTR_DATA.crm_attr_fk_kind_idnum = OBJ_KN.crm_kind_idnum          
    
                    </customSQL>
                </operationBindings>   
               </operationBindings>
            </DataSource>
    Last edited by debutant_ISC; 26 Feb 2014, 05:07.

    #2
    you need two levels of tags for operationBindings - an outer tag <operationBindings> and then an inner <operationBinding> tag

    Comment


      #3
      I added it, but I still have the same problem

      Comment


        #4
        Your XML is still invalid in some way, as you will probably see if you just open it in a browser.

        For the future, please be sure to test for these simple, non-framework matters before posting here. Then, use the developer console to help diagnose your problem, or to gather information about actual framework issues to help us track them down.

        Comment


          #5
          thank you anyway !
          i have another problem, can you help me please ?

          here is the link : http://forums.smartclient.com/showthread.php?p=116702#post116702

          thank you in advance

          Comment

          Working...
          X