Announcement

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

    fetch with operationId being ignored (updated)

    I took your advice:
    Originally posted by Isomorphic
    The correct way to set the optionOperationId is to set it on the SelectItem when you pass it to the form, and not try to change it after the fact.

    There's no need for any of these invalidateCache() calls or anything of the kind.
    In the form to find new Stakeholders, I have the following SelectItem:
    Code:
            <FormItem name="TEAMMEMBERID" title="Team Member" constructor="SelectItem">
                <valueField>TEAMMEMBERID</valueField>
                <displayField>TEAMMEMBERNAME</displayField>
                <optionDataSource><DataSource ref="TeamMember"/></optionDataSource>
                <optionOperationId>excludeCurrentStakeholders</optionOperationId>
                <autoFetchData>false</autoFetchData>
            </FormItem>
    The operationId is going after my negative join and trying to exclude in the list of potential new Stakeholders any Team Members that are already Stakeholders. I have an opertionID that selects a special fetch in the dataSource:
    Code:
     
    <DataSource ID="TeamMember" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
        <fields>
            <field name="TEAMMEMBERID" type="sequence" primaryKey="true"/>
            <field name="COMMUNITYID" type="text" required="true" title="Community" canEdit="false" foreignKey="Community.COMMUNITYID"/>
            <field name="TEAMMEMBERNAME" type="text" required="true" length="64" title="Name" canEdit="true"/>
            <field name="ENABLED" type="boolean" required="true" title="Enabled" canEdit="true"/>
            <field name="TEAMMEMBEREMAIL" type="text" length="64" title="Email" canEdit="true"/>
            <field name="EMAILCONFIRMED" type="boolean" required="true" title="Confirmed" canEdit="false"/>
            <field name="ORGANIZATIONID" type="text" required="true" title="Organization" canEdit="true" foreignKey="Organization.ORGANIZATIONID"/>
            <field name="BASEPHONE" type="text" length="64" title="Phone" canEdit="true"/>
            <field name="MOBILEPHONE" type="text" length="64" title="Mobile" canEdit="true"/>
            <field name="BASELOCATION" type="text" length="64" title="Location" detail="true" canEdit="true"/>
            <field name="BASETIMEZONE" type="text" length="64" title="Time Zone" detail="true" canEdit="true"/>
            <field name="BASELANGUAGE" type="text" length="64" title="Language" detail="true" canEdit="true"/>
            <field name="BASENUMBERFORMAT" type="text" length="64" title="Number Format" detail="true" canEdit="true"/>
            <field name="BASEDATEFORMAT" type="text" length="64" title="Date Format" detail="true" canEdit="true"/>
            <field name="COMMUNITYADMIN" type="boolean" title="Admin" detail="false" canEdit="true"/>
            <field name="LOG" type="text" length="2147483647" title="Log" detail="true"/>
            <field name="CREATED" type="creatorTimestamp" title="Created" detail="true"/>
            <field name="MODIFIED" type="modifierTimestamp" title="Modified" detail="true"/>
        </fields>
        <operationBindings>
            <OperationBinding operationType="fetch" operationId="excludeCurrentStakeholders">
                <tableClause>TeamMember CROSS JOIN Project LEFT JOIN Stakeholder ON Stakeholder.TeamMemberID = TeamMember.TeamMemberID AND Project.ProjectID = Stakeholder.ProjectID </tableClause>
                <whereClause>Stakeholder.TeamMemberID IS NULL AND ($defaultWhereClause)</whereClause>
                <invalidateCache>true</invalidateCache>
            </OperationBinding>
        </operationBindings>
        <cacheAllData>false</cacheAllData>
        <title>TeamMember</title>
        <titleField>TEAMMEMBERNAME</titleField>
        <pluralTitle>TeamMembers</pluralTitle>
        <generatedBy>SC_SNAPSHOT-2012-01-09_v8.2p/Pro Deployment 2012-01-09</generatedBy>
    </DataSource>
    I am invoking it from the SelectItem. I can see that in this (SECOND) RPCRequest:
    Code:
    {
        "dataSource":"TeamMember", 
        "operationType":"fetch", 
        "operationId":"excludeCurrentStakeholders", 
        "componentId":"isc_PickListMenu_3", 
        "data":{
            "Project.ProjectID":101, 
            "Stakeholder.CommunityID":101, 
            "TeamMember.CommunityID":101
        }, 
        "startRow":0, 
        "endRow":75, 
        "textMatchStyle":"startsWith", 
        "resultSet":[ResultSet ID:isc_ResultSet_12 (created by: isc_PickListMenu_3)], 
        "callback":{
            "caller":[ResultSet ID:isc_ResultSet_12 (created by: isc_PickListMenu_3)], 
            "methodName":"fetchRemoteDataReply"
        }, 
        "willHandleError":true, 
        "showPrompt":false, 
        "prompt":"Finding records that match your criteria...", 
        "clientContext":{
            "requestIndex":1
        }, 
        "requestId":"TeamMember$62713"
    }

    The result, which I cannot interpret, was:
    Code:
    {
        "status":0
    }
    As it turns out, the above is the SECOND of TWO requests made on the Team Member DS. Two requests.PNG show them side-be-side. I am not understanding. For some reason, there is a TeamMember DS request generated BEFORE the above RPCRrequest that does not use the operationID. RPC Log.PNG shows them both.

    The first (DS) request happens starting at 12:06:07.235.
    Code:
    {
        "dataSource":"TeamMember", 
        "operationType":"fetch", 
        "data":null, 
        "resultSet":[ResultSet ID:isc_ResultSet_13 (created by: undefined)], 
        "callback":{
            "caller":[ResultSet ID:isc_ResultSet_13 (created by: undefined)], 
            "methodName":"fetchRemoteDataReply"
        }, 
        "willHandleError":true, 
        "showPrompt":true, 
        "oldValues":null, 
        "clientContext":{
            "requestIndex":1
        }, 
        "requestId":"TeamMember$62714"
    }
    It retrieves all the Team Members, as you can see in the attached Result.PNG and the result from the DSRequest:
    Code:
    [
        {
            data:[
                {
                    ORGANIZATIONID:101, 
                    EMAILCONFIRMED:false, 
                    ENABLED:true, 
                    MODIFIED:new Date(1341864692453), 
                    TEAMMEMBERID:101, 
                    COMMUNITYID:101, 
                    CREATED:new Date(1341849600000), 
                    TEAMMEMBEREMAIL:"rick@menloparksoftware.com", 
                    COMMUNITYADMIN:true, 
                    TEAMMEMBERNAME:"Richard Bollinger"
                }, 
                {
                    ORGANIZATIONID:102, 
                    EMAILCONFIRMED:false, 
                    ENABLED:true, 
                    MODIFIED:new Date(1341864692468), 
                    TEAMMEMBERID:102, 
                    COMMUNITYID:101, 
                    CREATED:new Date(1341849600000), 
                    TEAMMEMBEREMAIL:"vicki.spencer@acs.com", 
                    COMMUNITYADMIN:false, 
                    TEAMMEMBERNAME:"Vicki Spencer"
                }, 
                {
                    ORGANIZATIONID:101, 
                    EMAILCONFIRMED:false, 
                    ENABLED:true, 
                    MODIFIED:new Date(1341864692468), 
                    TEAMMEMBERID:103, 
                    COMMUNITYID:101, 
                    CREATED:new Date(1341849600000), 
                    TEAMMEMBEREMAIL:"WhoMe@worry.com", 
                    COMMUNITYADMIN:false, 
                    TEAMMEMBERNAME:"Alfred E. Neuman"
                }, 
                {
                    ORGANIZATIONID:102, 
                    EMAILCONFIRMED:false, 
                    ENABLED:true, 
                    MODIFIED:new Date(1341864692468), 
                    TEAMMEMBERID:104, 
                    COMMUNITYID:101, 
                    CREATED:new Date(1341849600000), 
                    TEAMMEMBEREMAIL:"WhenDoI@eat.org", 
                    COMMUNITYADMIN:false, 
                    TEAMMEMBERNAME:"Lars P. Bear"
                }
            ], 
            endRow:4, 
            invalidateCache:false, 
            isDSResponse:true, 
            operationType:"fetch", 
            queueStatus:0, 
            startRow:0, 
            status:0, 
            totalRows:4
        }
    ]
    My suspicion is that, because of the previous fetch, the system thinks the second one is not necessary. There is no REAL fetch for the second request. If you look at the console log (attached) at 12:06:10.643, there is no SELECT statement or activity.

    It seems odd to me that a "[client only] RPCRequest" would be used with an operationId that requires an explicit SELECT on the server side.

    The fetch works if I can get to it:
    Code:
    select teammemberid, teammembername 
    from   teammember tm cross join project pr left join stakeholder sh 
    		on tm.teammemberid=sh.teammemberid and pr.projectid=sh.projectid 
    where  pr.projectid=101 and sh.teammemberid is null  ;
    When run against the database results in:
    Code:
    TEAMMEMBERID	TEAMMEMBERNAME	
    103	Alfred E. Neuman	
    104	Lars P. Bear
    I need to do this technique in a number of areas. The good news is that the workaround is easy: just don't select current stakeholders. It avoids an annoying error popup.

    Thanks,

    Rick

    P.S. I am running SmartClient Version: v8.2p_2012-06-08/EVAL Development Only on Mozilla Firefox 3.6.18 with Firebug using Windows XP Pro 32 bit.
    Attached Files

    #2
    It looks like for some reason you're setting cacheAllData:false. Remove this setting - its the default so it's meaningless, but it appears to be causing the cacheAllData behavior to kick in anyway.

    DataSources using the cacheAllData behavior have a single cache and so cannot have different operationBindings for "fetch".

    Comment


      #3
      The fetch is no longer ignored. I had problems with the criteria, however. So, I switched to customSQL for the datasource in question. I am no longer using $defaultWhereClause, but the simple criteria with the values I need are being critiqued unnecessarily. Below can be seen the comments.

      "=== 2012-07-31 12:25:14,093 [sor7] WARN DSRequest - In criteria, definition 'Project.ProjectID' refers to a related DataSource ('Project') that is not related to this dataSource ('TeamMember'). You can only specify fields in related DataSources where a foreignKey property establishes the relation from this dataSource ('TeamMember') to the related DataSource. Ignoring this criteria entry."

      I am doing a negative join. Stakeholder is a relationship table between TeamMember and Project. So, these last two will never have a foreignKey property establish the relation. I need to apply a criteria to a table being joined, and not one in the table list.

      I tried looking in the forums for the comment 'ignoring this criteria'. But, I was unable to do a search for the whole phrase. Only the words, and 'this' is always omitted.

      Is there a way to force the criteria to go through unmolested? Or, is there another way to communicate them through to the SQL?

      Thanks,

      Rick

      Comment


        #4
        A field name like Project.ProjectId is either invalid (a fieldName cannot contain a ".") or is an explicit request to join based on listGridField.includeFrom, which would be invalid unless a correct foreignKey relationship is set up. So you need to correct your usage rather than suppress this warning.

        Comment


          #5
          I very much appreciate the timely tutelage. I am getting closer. I changed the datasource spec to add ProjectID from the Project table. And, switched back to #defaultWhereClause from trying to play with $criteria.

          TeamMember.ds.xml is now
          Code:
          <DataSource ID="TeamMember" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
              <fields>
                  <field name="TEAMMEMBERID" type="sequence" primaryKey="true"/>
                  <field name="COMMUNITYID" type="text" required="true" title="Community" canEdit="false" foreignKey="Community.COMMUNITYID"/>
                  <field name="TEAMMEMBERNAME" type="text" required="true" length="64" title="Name" canEdit="true"/>
                  <field name="ENABLED" type="boolean" required="true" title="Enabled" canEdit="true"/>
                  <field name="TEAMMEMBEREMAIL" type="text" length="64" title="Email" canEdit="true"/>
                  <field name="EMAILCONFIRMED" type="boolean" required="true" title="Confirmed" canEdit="false"/>
                  <field name="ORGANIZATIONID" type="text" required="true" title="Organization" canEdit="true" foreignKey="Organization.ORGANIZATIONID"/>
                  <field name="ORGANIZATIONNAME" type="text" required="true" title="Organization" canEdit="false">
                      <tableName>Organization</tableName>
                  </field>
                  <field name="BASEPHONE" type="text" length="64" title="Phone" canEdit="true"/>
                  <field name="MOBILEPHONE" type="text" length="64" title="Mobile" canEdit="true"/>
                  <field name="BASELOCATION" type="text" length="64" title="Location" detail="true" canEdit="true"/>
                  <field name="BASETIMEZONE" type="text" length="64" title="Time Zone" detail="true" canEdit="true"/>
                  <field name="BASELANGUAGE" type="text" length="64" title="Language" detail="true" canEdit="true"/>
                  <field name="BASENUMBERFORMAT" type="text" length="64" title="Number Format" detail="true" canEdit="true"/>
                  <field name="BASEDATEFORMAT" type="text" length="64" title="Date Format" detail="true" canEdit="true"/>
                  <field name="COMMUNITYADMIN" type="boolean" title="Admin" detail="false" canEdit="true"/>
                  <field name="LOG" type="text" length="2147483647" title="Log" detail="true"/>
                  <field name="CREATED" type="creatorTimestamp" title="Created" detail="true"/>
                  <field name="MODIFIED" type="modifierTimestamp" title="Modified" detail="true"/>
                  <field name="PROJECTID" type="text" title="ProjectID" foreignKey="Project.PROJECTID">
                  	<tableName>Project</tableName>
                  </field>
              </fields>
              <operationBindings>
                  <OperationBinding>
                      <operationType>fetch</operationType>
                      <customSQL>
                      	SELECT $defaultSelectClause FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID
                      	WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                      </customSQL>
                      <operationId>excludeCurrentStakeholders</operationId>
                  </OperationBinding>
              </operationBindings>
              <title>TeamMember</title>
              <titleField>TEAMMEMBERNAME</titleField>
              <pluralTitle>TeamMembers</pluralTitle>
              <generatedBy>SC_SNAPSHOT-2012-01-09_v8.2p/Pro Deployment 2012-01-09</generatedBy>
          </DataSource>
          I had a clause to exclude Project.PROJECTID in the binding, but I deleted it thinking that was the problem. But, apparently SC is excluding it now on its own. The ProjectID and CommunityID criteria are on the call, but ProjectID does not make it into the Select statement for some reason that is not recorded.

          The result is
          Code:
          === 2012-07-31 17:39:15,453 [or12] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
                  ProjectID:101,
                  CommunityID:101
              },
              operationConfig:{
                  dataSource:"TeamMember",
                  operationType:"fetch",
                  textMatchStyle:"startsWith"
              },
              startRow:0,
              endRow:75,
              componentId:"isc_PickListMenu_4",
              appID:"builtinApplication",
              operation:"excludeCurrentStakeholders",
              oldValues:{
                  ProjectID:101,
                  CommunityID:101
              }
          }
          === 2012-07-31 17:39:15,500 [or12] INFO  IDACall - Performing 1 operation(s)
          === 2012-07-31 17:39:15,500 [or12] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No userTypes defined, 
          allowing anyone access to all operations for this application
          === 2012-07-31 17:39:15,515 [or12] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No public zero-argument method 
          named '_excludeCurrentStakeholders' found, performing generic datasource operation
          === 2012-07-31 17:39:15,515 [or12] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] 
          Performing fetch operation with criteria: {ProjectID:101,CommunityID:101} values: {ProjectID:101,CommunityID:101}
          === 2012-07-31 17:39:15,531 [or12] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] 
          Executing SQL query on 'PlanetProjectDB': SELECT TeamMember.BASEDATEFORMAT, TeamMember.BASELANGUAGE, TeamMember.BASELOCATION, 
          TeamMember.BASENUMBERFORMAT, TeamMember.BASEPHONE, TeamMember.BASETIMEZONE, TeamMember.BaseDateFormat, TeamMember.BaseLanguage, 
          TeamMember.BaseLocation, TeamMember.BaseNumberFormat, TeamMember.BasePhone, TeamMember.BaseTimeZone, TeamMember.COMMUNITYADMIN, 
          TeamMember.COMMUNITYID, TeamMember.CREATED, TeamMember.CommunityAdmin, TeamMember.CommunityID, TeamMember.Created, 
          TeamMember.Description, TeamMember.EMAILCONFIRMED, TeamMember.ENABLED, TeamMember.EmailConfirmed, TeamMember.Enabled, TeamMember.LOG, 
          TeamMember.Log, TeamMember.MOBILEPHONE, TeamMember.MODIFIED, TeamMember.MobilePhone, TeamMember.Modified, 
          TeamMember.ORGANIZATIONID, Organization.ORGANIZATIONNAME, TeamMember.OrganizationID, Project.PROJECTID, 
          TeamMember.TEAMMEMBEREMAIL, TeamMember.TEAMMEMBERID, TeamMember.TEAMMEMBERNAME, TeamMember.TeamMemberEmail, 
          TeamMember.TeamMemberID, TeamMember.TeamMemberName FROM (Organization, TeamMember) cross join Project left join Stakeholder 
          on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID
          WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ((TeamMember.CommunityID='101'))
          Thanks. I'm going out for a beer and a break.

          Rick

          Comment


            #6
            You've got "tableName" set on ProjectID, and by default we'll only generate SQL for such a field when you don't use customSQL, because we'd normally need control of the "from" clause in order to know that we'd be generating correct SQL.

            Setting operationBinding.customFields would allow SQL for that field to be generated.

            Comment


              #7
              For some reason the field is still being ignored. I followed the Custom Querying Overview guide and set customSQL="true" on PROJECTID and added it in customFields in the operationBinding.
              Code:
              <DataSource ID="TeamMember" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
                  <fields>
                      <field name="TEAMMEMBERID" type="sequence" primaryKey="true"/>
                      <field name="COMMUNITYID" type="text" required="true" title="Community" canEdit="false" foreignKey="Community.COMMUNITYID"/>
                      <field name="TEAMMEMBERNAME" type="text" required="true" length="64" title="Name" canEdit="true"/>
                      <field name="ENABLED" type="boolean" required="true" title="Enabled" canEdit="true"/>
                      <field name="TEAMMEMBEREMAIL" type="text" length="64" title="Email" canEdit="true"/>
                      <field name="EMAILCONFIRMED" type="boolean" required="true" title="Confirmed" canEdit="false"/>
                      <field name="ORGANIZATIONID" type="text" required="true" title="Organization" canEdit="true" foreignKey="Organization.ORGANIZATIONID"/>
                      <field name="ORGANIZATIONNAME" type="text" required="true" title="Organization" canEdit="false">
                          <tableName>Organization</tableName>
                      </field>
                      <field name="BASEPHONE" type="text" length="64" title="Phone" canEdit="true"/>
                      <field name="MOBILEPHONE" type="text" length="64" title="Mobile" canEdit="true"/>
                      <field name="BASELOCATION" type="text" length="64" title="Location" detail="true" canEdit="true"/>
                      <field name="BASETIMEZONE" type="text" length="64" title="Time Zone" detail="true" canEdit="true"/>
                      <field name="BASELANGUAGE" type="text" length="64" title="Language" detail="true" canEdit="true"/>
                      <field name="BASENUMBERFORMAT" type="text" length="64" title="Number Format" detail="true" canEdit="true"/>
                      <field name="BASEDATEFORMAT" type="text" length="64" title="Date Format" detail="true" canEdit="true"/>
                      <field name="COMMUNITYADMIN" type="boolean" title="Admin" detail="false" canEdit="true"/>
                      <field name="LOG" type="text" length="2147483647" title="Log" detail="true"/>
                      <field name="CREATED" type="creatorTimestamp" title="Created" detail="true"/>
                      <field name="MODIFIED" type="modifierTimestamp" title="Modified" detail="true"/>
                      <field name="PROJECTID" type="text" title="ProjectID" customSQL="true" foreignKey="Project.PROJECTID">
                      	<tableName>Project</tableName>
                      </field>
                  </fields>
                  <operationBindings>
                      <OperationBinding>
                          <operationType>fetch</operationType>
                          <customSQL>
                          	SELECT $defaultSelectClause FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID
                          	WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                          </customSQL>
                          <customFields>PROJECTID</customFields>
                          <operationId>excludeCurrentStakeholders</operationId>
                      </OperationBinding>
                  </operationBindings>
                  <title>TeamMember</title>
                  <titleField>TEAMMEMBERNAME</titleField>
                  <pluralTitle>TeamMembers</pluralTitle>
                  <generatedBy>SC_SNAPSHOT-2012-01-09_v8.2p/Pro Deployment 2012-01-09</generatedBy>
              </DataSource>
              The datasource was added without problem.
              Code:
              === 2012-08-03 09:21:29,218 [sor2] INFO  SQLDSGenerator - Fetching column metadata for TeamMember complete
              === 2012-08-03 09:21:29,218 [sor2] WARN  SQLDataSource - ds:isc.DataSource.create({
                  schema:"PUBLIC",
                  dbName:"PlanetProjectDB",
                  ID:"TeamMember_inheritsFrom",
                  dataSourceVersion:"1",
                  serverType:"sql",
                  generatedBy:"v8.2p_2012-07-19/EVAL Deployment 2012-07-19",
                  fields:[
                      {
                          name:"TeamMemberID",
                          primaryKey:true,
                          type:"integer"
                      },
                      {
                          name:"CommunityID",
                          type:"integer"
                      },
                      {
                          name:"TeamMemberName",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"Enabled",
                          type:"integer"
                      },
                      {
                          name:"TeamMemberEmail",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"EmailConfirmed",
                          type:"integer"
                      },
                      {
                          name:"OrganizationID",
                          type:"integer"
                      },
                      {
                          name:"BasePhone",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"MobilePhone",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"BaseLocation",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"BaseTimeZone",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"BaseLanguage",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"BaseNumberFormat",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"BaseDateFormat",
                          length:64,
                          type:"text"
                      },
                      {
                          name:"CommunityAdmin",
                          type:"integer"
                      },
                      {
                          name:"Description",
                          length:65535,
                          type:"text"
                      },
                      {
                          name:"Log",
                          length:65535,
                          type:"text"
                      },
                      {
                          name:"Created",
                          type:"datetime"
                      },
                      {
                          name:"Modified",
                          type:"datetime"
                      }
                  ]
              })
              
              === 2012-08-03 09:21:29,500 [sor2] INFO  DataSource - No test data file for datasource 'TeamMember.  Tried D:\My Websites\Pl
              But, the field is still not getting into the fetch SQL.
              Code:
              === 2012-08-03 09:27:23,421 [sor2] DEBUG RPCManager - Processing 1 requests.
              === 2012-08-03 09:27:23,421 [sor2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                      ProjectID:101,
                      CommunityID:101
                  },
                  operationConfig:{
                      dataSource:"TeamMember",
                      operationType:"fetch",
                      textMatchStyle:"startsWith"
                  },
                  startRow:0,
                  endRow:75,
                  componentId:"isc_PickListMenu_4",
                  appID:"builtinApplication",
                  operation:"excludeCurrentStakeholders",
                  oldValues:{
                      ProjectID:101,
                      CommunityID:101
                  }
              }
              === 2012-08-03 09:27:23,453 [sor2] INFO  IDACall - Performing 1 operation(s)
              === 2012-08-03 09:27:23,453 [sor2] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No userTypes defined, all
              owing anyone access to all operations for this application
              === 2012-08-03 09:27:23,453 [sor2] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No public zero-argument m
              ethod named '_excludeCurrentStakeholders' found, performing generic datasource operation
              === 2012-08-03 09:27:23,453 [sor2] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Performing fetch op
              eration with
                      criteria: {ProjectID:101,CommunityID:101}       values: {ProjectID:101,CommunityID:101}
              === 2012-08-03 09:27:23,453 [sor2] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Executing SQL query
               on 'PlanetProjectDB': SELECT TeamMember.BASEDATEFORMAT, TeamMember.BASELANGUAGE, TeamMember.BASELOCATION, TeamMember.BASENU
              MBERFORMAT, TeamMember.BASEPHONE, TeamMember.BASETIMEZONE, TeamMember.BaseDateFormat, TeamMember.BaseLanguage, TeamMember.Ba
              seLocation, TeamMember.BaseNumberFormat, TeamMember.BasePhone, TeamMember.BaseTimeZone, TeamMember.COMMUNITYADMIN, TeamMembe
              r.COMMUNITYID, TeamMember.CREATED, TeamMember.CommunityAdmin, TeamMember.CommunityID, TeamMember.Created, TeamMember.Descrip
              tion, TeamMember.EMAILCONFIRMED, TeamMember.ENABLED, TeamMember.EmailConfirmed, TeamMember.Enabled, TeamMember.LOG, TeamMemb
              er.Log, TeamMember.MOBILEPHONE, TeamMember.MODIFIED, TeamMember.MobilePhone, TeamMember.Modified, TeamMember.ORGANIZATIONID,
               Organization.ORGANIZATIONNAME, TeamMember.OrganizationID, Project.PROJECTID, TeamMember.TEAMMEMBEREMAIL, TeamMember.TEAMMEM
              BERID, TeamMember.TEAMMEMBERNAME, TeamMember.TeamMemberEmail, TeamMember.TeamMemberID, TeamMember.TeamMemberName FROM (Organ
              ization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Projec
              t.PROJECTID=Stakeholder.PROJECTID
                              WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ((Tea
              mMember.CommunityID='101'))
              So, I get 13 records back instead of just the 2 I expect.

              I am going to try again and get rid of the customSQL.

              Thanks,

              Rick

              Comment


                #8
                It does not work without customSQL, either. I added PROJECTID to the operationBinding in customFields.

                Code:
                <DataSource ID="TeamMember" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
                    <fields>
                        <field name="TEAMMEMBERID" type="sequence" primaryKey="true"/>
                        <field name="COMMUNITYID" type="text" required="true" title="Community" canEdit="false" foreignKey="Community.COMMUNITYID"/>
                        <field name="TEAMMEMBERNAME" type="text" required="true" length="64" title="Name" canEdit="true"/>
                        <field name="ENABLED" type="boolean" required="true" title="Enabled" canEdit="true"/>
                        <field name="TEAMMEMBEREMAIL" type="text" length="64" title="Email" canEdit="true"/>
                        <field name="EMAILCONFIRMED" type="boolean" required="true" title="Confirmed" canEdit="false"/>
                        <field name="ORGANIZATIONID" type="text" required="true" title="Organization" canEdit="true" foreignKey="Organization.ORGANIZATIONID"/>
                        <field name="ORGANIZATIONNAME" type="text" required="true" title="Organization" canEdit="false">
                            <tableName>Organization</tableName>
                        </field>
                        <field name="BASEPHONE" type="text" length="64" title="Phone" canEdit="true"/>
                        <field name="MOBILEPHONE" type="text" length="64" title="Mobile" canEdit="true"/>
                        <field name="BASELOCATION" type="text" length="64" title="Location" detail="true" canEdit="true"/>
                        <field name="BASETIMEZONE" type="text" length="64" title="Time Zone" detail="true" canEdit="true"/>
                        <field name="BASELANGUAGE" type="text" length="64" title="Language" detail="true" canEdit="true"/>
                        <field name="BASENUMBERFORMAT" type="text" length="64" title="Number Format" detail="true" canEdit="true"/>
                        <field name="BASEDATEFORMAT" type="text" length="64" title="Date Format" detail="true" canEdit="true"/>
                        <field name="COMMUNITYADMIN" type="boolean" title="Admin" detail="false" canEdit="true"/>
                        <field name="LOG" type="text" length="2147483647" title="Log" detail="true"/>
                        <field name="CREATED" type="creatorTimestamp" title="Created" detail="true"/>
                        <field name="MODIFIED" type="modifierTimestamp" title="Modified" detail="true"/>
                        <field name="PROJECTID" type="text" title="ProjectID" foreignKey="Project.PROJECTID">
                        	<tableName>Project</tableName>
                        </field>
                    </fields>
                    <operationBindings>
                    	<OperationBinding operationType="fetch" operationId="excludeCurrentStakeholders">
                		    <tableClause>(Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID</tableClause>
                            <whereClause>Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)</whereClause>
                            <customFields>PROJECTID</customFields>
                        </OperationBinding>
                    </operationBindings>
                    <title>TeamMember</title>
                    <titleField>TEAMMEMBERNAME</titleField>
                    <pluralTitle>TeamMembers</pluralTitle>
                    <generatedBy>SC_SNAPSHOT-2012-01-09_v8.2p/Pro Deployment 2012-01-09</generatedBy>
                </DataSource>
                Results in...
                Code:
                === 2012-08-03 10:12:14,828 [sor3] DEBUG RPCManager - Processing 1 requests.
                === 2012-08-03 10:12:14,953 [sor3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                    criteria:{
                        ProjectID:101,
                        CommunityID:101
                    },
                    operationConfig:{
                        dataSource:"TeamMember",
                        operationType:"fetch",
                        textMatchStyle:"startsWith"
                    },
                    startRow:0,
                    endRow:75,
                    componentId:"isc_PickListMenu_4",
                    appID:"builtinApplication",
                    operation:"excludeCurrentStakeholders",
                    oldValues:{
                        ProjectID:101,
                        CommunityID:101
                    }
                }
                === 2012-08-03 10:12:14,953 [sor3] INFO  IDACall - Performing 1 operation(s)
                === 2012-08-03 10:12:14,953 [sor3] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No userTypes defined, all
                owing anyone access to all operations for this application
                === 2012-08-03 10:12:14,953 [sor3] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No public zero-argument m
                ethod named '_excludeCurrentStakeholders' found, performing generic datasource operation
                === 2012-08-03 10:12:14,953 [sor3] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Performing fetch op
                eration with
                        criteria: {ProjectID:101,CommunityID:101}       values: {ProjectID:101,CommunityID:101}
                === 2012-08-03 10:12:14,984 [sor3] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] derived query: SELE
                CT $defaultSelectClause FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                === 2012-08-03 10:12:14,984 [sor3] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Executing row count
                 query: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                === 2012-08-03 10:12:14,984 [sor3] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Eval'd row count qu
                ery: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Sta
                keholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIO
                NID AND Stakeholder.TEAMMEMBERID IS NULL AND ((TeamMember.CommunityID='101'))
                Next, I will add customSQL="true" to PROJECTID like the reference says.
                ...set customSQL="true" on the field, and use OperationBinding.customFields to cause specific operationBindings to generate SQL for the field, while all others ignore it.

                Comment


                  #9
                  I had no luck with adding customSQL="true" on the ignored field, either.

                  Code:
                  <DataSource ID="TeamMember" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
                      <fields>
                          <field name="TEAMMEMBERID" type="sequence" primaryKey="true"/>
                          <field name="COMMUNITYID" type="text" required="true" title="Community" canEdit="false" foreignKey="Community.COMMUNITYID"/>
                          <field name="TEAMMEMBERNAME" type="text" required="true" length="64" title="Name" canEdit="true"/>
                          <field name="ENABLED" type="boolean" required="true" title="Enabled" canEdit="true"/>
                          <field name="TEAMMEMBEREMAIL" type="text" length="64" title="Email" canEdit="true"/>
                          <field name="EMAILCONFIRMED" type="boolean" required="true" title="Confirmed" canEdit="false"/>
                          <field name="ORGANIZATIONID" type="text" required="true" title="Organization" canEdit="true" foreignKey="Organization.ORGANIZATIONID"/>
                          <field name="ORGANIZATIONNAME" type="text" required="true" title="Organization" canEdit="false">
                              <tableName>Organization</tableName>
                          </field>
                          <field name="BASEPHONE" type="text" length="64" title="Phone" canEdit="true"/>
                          <field name="MOBILEPHONE" type="text" length="64" title="Mobile" canEdit="true"/>
                          <field name="BASELOCATION" type="text" length="64" title="Location" detail="true" canEdit="true"/>
                          <field name="BASETIMEZONE" type="text" length="64" title="Time Zone" detail="true" canEdit="true"/>
                          <field name="BASELANGUAGE" type="text" length="64" title="Language" detail="true" canEdit="true"/>
                          <field name="BASENUMBERFORMAT" type="text" length="64" title="Number Format" detail="true" canEdit="true"/>
                          <field name="BASEDATEFORMAT" type="text" length="64" title="Date Format" detail="true" canEdit="true"/>
                          <field name="COMMUNITYADMIN" type="boolean" title="Admin" detail="false" canEdit="true"/>
                          <field name="LOG" type="text" length="2147483647" title="Log" detail="true"/>
                          <field name="CREATED" type="creatorTimestamp" title="Created" detail="true"/>
                          <field name="MODIFIED" type="modifierTimestamp" title="Modified" detail="true"/>
                          <field name="PROJECTID" type="text" title="ProjectID" customSQL="true" foreignKey="Project.PROJECTID">
                          	<tableName>Project</tableName>
                          </field>
                      </fields>
                      <operationBindings>
                      	<OperationBinding operationType="fetch" operationId="excludeCurrentStakeholders">
                  		    <tableClause>(Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID</tableClause>
                              <whereClause>Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)</whereClause>
                              <customFields>PROJECTID</customFields>
                          </OperationBinding>
                      </operationBindings>
                      <title>TeamMember</title>
                      <titleField>TEAMMEMBERNAME</titleField>
                      <pluralTitle>TeamMembers</pluralTitle>
                      <generatedBy>SC_SNAPSHOT-2012-01-09_v8.2p/Pro Deployment 2012-01-09</generatedBy>
                  </DataSource>
                  Code:
                  === 2012-08-03 11:05:07,968 [sor6] DEBUG RPCManager - Processing 1 requests.
                  === 2012-08-03 11:05:08,109 [sor6] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                      criteria:{
                          ProjectID:101,
                          CommunityID:101
                      },
                      operationConfig:{
                          dataSource:"TeamMember",
                          operationType:"fetch",
                          textMatchStyle:"startsWith"
                      },
                      startRow:0,
                      endRow:75,
                      componentId:"isc_PickListMenu_4",
                      appID:"builtinApplication",
                      operation:"excludeCurrentStakeholders",
                      oldValues:{
                          ProjectID:101,
                          CommunityID:101
                      }
                  }
                  === 2012-08-03 11:05:08,109 [sor6] INFO  IDACall - Performing 1 operation(s)
                  === 2012-08-03 11:05:08,109 [sor6] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No userTypes defined, all
                  owing anyone access to all operations for this application
                  === 2012-08-03 11:05:08,109 [sor6] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No public zero-argument m
                  ethod named '_excludeCurrentStakeholders' found, performing generic datasource operation
                  === 2012-08-03 11:05:08,109 [sor6] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Performing fetch op
                  eration with
                          criteria: {ProjectID:101,CommunityID:101}       values: {ProjectID:101,CommunityID:101}
                  === 2012-08-03 11:05:08,125 [sor6] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] derived query: SELE
                  CT $defaultSelectClause FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                  Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                  TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                  === 2012-08-03 11:05:08,125 [sor6] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Executing row count
                   query: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                  Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                  TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ($defaultWhereClause)
                  === 2012-08-03 11:05:08,125 [sor6] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Eval'd row count qu
                  ery: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Sta
                  keholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIO
                  NID AND Stakeholder.TEAMMEMBERID IS NULL AND ((TeamMember.CommunityID='101'))
                  === 2012-08-03 11:05:08,125 [sor6] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Driv
                  erManager fetching connection for PlanetProjectDB via jdbc url jdbc:mysql://localhost:3306/public
                  === 2012-08-03 11:05:08,125 [sor6] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Pass
                  ing JDBC URL only to getConnection
                  === 2012-08-03 11:05:08,187 [sor6] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Retu
                  rning pooled Connection
                  === 2012-08-03 11:05:08,187 [sor6] DEBUG SQLTransaction - [builtinApplication.excludeCurrentStakeholders] Started new Planet
                  ProjectDB transaction "24712756"
                  === 2012-08-03 11:05:08,187 [sor6] INFO  SQLDriver - [builtinApplication.excludeCurrentStakeholders] Executing SQL query on
                  'PlanetProjectDB': SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TE
                  AMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMemb
                  er.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ((TeamMember.CommunityID='101'))
                  === 2012-08-03 11:05:08,187 [sor6] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Using SQL Limit que
                  ry
                  === 2012-08-03 11:05:08,187 [sor6] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] SQL windowed select
                   rows 0->75, result size 75. Query: SELECT TeamMember.BASEDATEFORMAT, TeamMember.BASELANGUAGE, TeamMember.BASELOCATION, Team
                  Member.BASENUMBERFORMAT, TeamMember.BASEPHONE, TeamMember.BASETIMEZONE, TeamMember.BaseDateFormat, TeamMember.BaseLanguage,
                  TeamMember.BaseLocation, TeamMember.BaseNumberFormat, TeamMember.BasePhone, TeamMember.BaseTimeZone, TeamMember.COMMUNITYADM
                  IN, TeamMember.COMMUNITYID, TeamMember.CREATED, TeamMember.CommunityAdmin, TeamMember.CommunityID, TeamMember.Created, TeamM
                  ember.Description, TeamMember.EMAILCONFIRMED, TeamMember.ENABLED, TeamMember.EmailConfirmed, TeamMember.Enabled, TeamMember.
                  LOG, TeamMember.Log, TeamMember.MOBILEPHONE, TeamMember.MODIFIED, TeamMember.MobilePhone, TeamMember.Modified, TeamMember.OR
                  GANIZATIONID, Organization.ORGANIZATIONNAME, TeamMember.OrganizationID, Project.PROJECTID, TeamMember.TEAMMEMBEREMAIL, TeamM
                  ember.TEAMMEMBERID, TeamMember.TEAMMEMBERNAME, TeamMember.TeamMemberEmail, TeamMember.TeamMemberID, TeamMember.TeamMemberNam
                  e FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBER
                  ID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND ((TeamMember.CommunityID='101')) LIMIT 0, 75
                  === 2012-08-03 11:05:08,203 [sor6] INFO  DSResponse - [builtinApplication.excludeCurrentStakeholders] DSResponse: List with 13 items
                  So, I am at a loss as to what I am doing to make the framework not behave as described in the reference and your excellent advice. Or, am I not understanding.

                  Rick

                  Comment


                    #10
                    In general the framework is not going to generate SQL for a field where we have no way of knowing what the right SQL would be.

                    So if you are able to set field.includeFrom for this field, hence letting the framework handle the join, then you can include it in both the selectClause and whereClause via customFields.

                    Otherwise you just add it yourself.

                    Comment


                      #11
                      I appreciate the depth and timeliness of all the responses.

                      I don't think setting the includeFrom for this ignored field, PROJECTID, will work. The reference for this attribute says a foreignKey declaration must exist between the two DataSources, establishing either a 1-to-1 relationship or a many-to-1 relationship from this DataSource to the related DataSource.

                      I take that to mean that the TeamMember table must have a PROJECTID foreign key. But, that will not be true in my system.

                      This discussion started with what I believed was a technical problem with narrow context. Let me apologize and present the larger context.

                      I am trying to implement a negative join on the TeamMember datasource. My purpose is to assemble a picklist of TeamMembers to become new Stakeholders for a Project that are NOT already Stakeholders for that Project. Hence the negative join. I have attached a diagram of the relationships in this instance. The Stakeholder table represents the relationship between Projects and TeamMembers. It has a foreign key to both of them and stands between them.

                      Maybe the method I am trying is incorrect and I should be doing it using another DataSource. I am wide open to suggestion as to how this should be done. I will be using the technique in a number of circumstances.

                      Your advice is very intriguing and to the point to this discussion. I will look and see if I can apply it using the Stakeholder DataSource. Maybe by Monday morning I will have figured out the correct method.

                      Many thanks,

                      Rick
                      Attached Files
                      Last edited by RickBollinger; 4 Aug 2012, 06:36.

                      Comment


                        #12
                        With a good night's sleep and a cup of coffee I realize that I cannot use the $defaultWhereClause. No matter what dataSource I choose into which to place the negative join, I will need to apply a criterion to a different table/datasource.

                        So, I looked back to the reference and reacquainted myself with $criteria. I figured I could pull out the criteria values and apply them to the tables to which I need.

                        Except that, for some reason, I am not able to "refer to container variables $criteria and $values in [my] queries or clause snippets".

                        I am running SmartClient Version: v8.2p_2012-07-19/EVAL Development Only on Mozilla Firefox 12.0 with Firebug using Windows XP Pro 32 bit. I assume the the EVAL version includes SQL Templating.

                        So, I think I have the solution to my negative join. I just need to know how to turn on SQL Templating or invoke the process that makes $criteria available for reference.

                        I will be staying up late tonight to see the new Martian rover 'Curiosity' attempt to land. Supposedly, it hits the top of Mars's atmosphere around 1:30 AM EDT and lands 7 minutes later. 14 minutes after that, due to the interplanetary trip the signal must take, we will know if it made it or not.

                        Thanks,

                        Rick

                        P.S. Here is the console log at the end.
                        Code:
                        === 2012-08-05 12:27:48,582 [sor2] DEBUG RPCManager - Processing 1 requests.
                        === 2012-08-05 12:27:48,692 [sor2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                            criteria:{
                                ProjectID:101,
                                CommunityID:101
                            },
                            operationConfig:{
                                dataSource:"TeamMember",
                                operationType:"fetch",
                                textMatchStyle:"startsWith"
                            },
                            startRow:0,
                            endRow:75,
                            componentId:"isc_PickListMenu_4",
                            appID:"builtinApplication",
                            operation:"excludeCurrentStakeholders",
                            oldValues:{
                                ProjectID:101,
                                CommunityID:101
                            }
                        }
                        === 2012-08-05 12:27:48,739 [sor2] INFO  IDACall - Performing 1 operation(s)
                        === 2012-08-05 12:27:48,739 [sor2] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No userTypes defined, all
                        owing anyone access to all operations for this application
                        === 2012-08-05 12:27:48,754 [sor2] DEBUG AppBase - [builtinApplication.excludeCurrentStakeholders] No public zero-argument m
                        ethod named '_excludeCurrentStakeholders' found, performing generic datasource operation
                        === 2012-08-05 12:27:48,754 [sor2] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Performing fetch op
                        eration with
                                criteria: {ProjectID:101,CommunityID:101}       values: {ProjectID:101,CommunityID:101}
                        === 2012-08-05 12:27:48,770 [sor2] INFO  SQLDataSource - [builtinApplication.excludeCurrentStakeholders] derived query: SELE
                        CT $defaultSelectClause FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                        Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                        TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND TeamMember.COMMUNITYID = $criteria.COMMUNITYID AND Project.PROJECTID = $crit
                        eria.PROJECTID
                        === 2012-08-05 12:27:48,832 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 326] : $criteria.COMMUN
                        ITYID cannot be resolved.
                        === 2012-08-05 12:27:48,832 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 326] : $criteria.COMMUN
                        ITYID cannot be resolved.
                        === 2012-08-05 12:27:48,848 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 372] : $criteria.PROJEC
                        TID cannot be resolved.
                        === 2012-08-05 12:27:48,848 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 372] : $criteria.PROJEC
                        TID cannot be resolved.
                        === 2012-08-05 12:27:48,848 [sor2] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Executing row count
                         query: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=
                        Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZA
                        TIONID AND Stakeholder.TEAMMEMBERID IS NULL AND TeamMember.COMMUNITYID = $criteria.COMMUNITYID AND Project.PROJECTID = $crit
                        eria.PROJECTID
                        === 2012-08-05 12:27:48,864 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 314] : $criteria.COMMUN
                        ITYID cannot be resolved.
                        === 2012-08-05 12:27:48,864 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 314] : $criteria.COMMUN
                        ITYID cannot be resolved.
                        === 2012-08-05 12:27:48,879 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 360] : $criteria.PROJEC
                        TID cannot be resolved.
                        === 2012-08-05 12:27:48,879 [sor2] DEBUG Velocity - Null reference [template 'fetch', line 1, column 360] : $criteria.PROJEC
                        TID cannot be resolved.
                        === 2012-08-05 12:27:48,895 [sor2] DEBUG SQLDataSource - [builtinApplication.excludeCurrentStakeholders] Eval'd row count qu
                        ery: SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Sta
                        keholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMember.ORGANIZATIO
                        NID AND Stakeholder.TEAMMEMBERID IS NULL AND TeamMember.COMMUNITYID = $criteria.COMMUNITYID AND Project.PROJECTID = $criteri
                        a.PROJECTID
                        === 2012-08-05 12:27:48,910 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Driv
                        erManager fetching connection for PlanetProjectDB via jdbc url jdbc:mysql://localhost:3306/public
                        === 2012-08-05 12:27:48,926 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Pass
                        ing JDBC URL only to getConnection
                        === 2012-08-05 12:27:48,942 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.excludeCurrentStakeholders] Retu
                        rning pooled Connection
                        === 2012-08-05 12:27:48,942 [sor2] DEBUG SQLTransaction - [builtinApplication.excludeCurrentStakeholders] Started new Planet
                        ProjectDB transaction "26034519"
                        === 2012-08-05 12:27:48,957 [sor2] INFO  SQLDriver - [builtinApplication.excludeCurrentStakeholders] Executing SQL query on
                        'PlanetProjectDB': SELECT COUNT(*) FROM (Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TE
                        AMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID WHERE Organization.ORGANIZATIONID = TeamMemb
                        er.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND TeamMember.COMMUNITYID = $criteria.COMMUNITYID AND Project.PROJEC
                        TID = $criteria.PROJECTID
                        === 2012-08-05 12:27:48,973 [sor2] WARN  RequestContext - dsRequest.execute() failed:
                        com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '$criteria.COMMUNITYID' in 'where clause'
                                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                                at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
                                at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
                                at com.mysql.jdbc.Util.getInstance(Util.java:386)
                                at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
                                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
                                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
                                at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
                                at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
                                at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
                                at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2663)
                                at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1599)
                                at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
                                at com.isomorphic.sql.SQLDriver.getTransformedResults(SQLDriver.java:333)
                                at com.isomorphic.sql.SQLDriver.getTransformedResults(SQLDriver.java:287)
                                at com.isomorphic.sql.SQLDriver.getTransformedResults(SQLDriver.java:280)
                                at com.isomorphic.sql.SQLDriver.getScalarResult(SQLDriver.java:421)
                                at com.isomorphic.sql.SQLDriver.executeScalar(SQLDriver.java:635)
                                at com.isomorphic.sql.SQLDataSource.executeWindowedSelect(SQLDataSource.java:1628)
                                at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1317)
                                at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:293)
                                at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:237)
                                at com.isomorphic.datasource.DataSource.execute(DataSource.java:1289)
                                at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:725)
                                at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
                                at com.isomorphic.application.AppBase.execute(AppBase.java:491)
                                at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1954)
                                at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
                                at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
                                at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
                                at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
                                at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                                at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
                                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                                at com.isomorphic.js.JSSyntaxScannerFilter.doFilter(JSSyntaxScannerFilter.java:241)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                                at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
                                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
                                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
                                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
                                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
                                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
                                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665
                        )
                                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
                                at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
                                at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
                                at java.lang.Thread.run(Thread.java:722)
                        Last edited by RickBollinger; 5 Aug 2012, 08:52.

                        Comment


                          #13
                          Use $criteria.fieldName and match capitalization of the fieldName, not the database column name.

                          Comment


                            #14
                            DOH! It works!

                            So, for other forum surfers looking for negative join details. Here they are due to the depth and persistence of support from isomorphic and the benefits of using SQL Templating. First is the operationBinding with the fetch.
                            Code:
                                <operationBindings>
                                	<OperationBinding operationType="fetch" operationId="excludeCurrentStakeholders">
                            		    <tableClause>(Organization, TeamMember) cross join Project left join Stakeholder on TeamMember.TEAMMEMBERID=Stakeholder.TEAMMEMBERID and Project.PROJECTID=Stakeholder.PROJECTID</tableClause>
                                        <whereClause>Organization.ORGANIZATIONID = TeamMember.ORGANIZATIONID AND Stakeholder.TEAMMEMBERID IS NULL AND TeamMember.COMMUNITYID = $criteria.COMMUNITYID AND Project.PROJECTID = $criteria.PROJECTID</whereClause>
                                    </OperationBinding>
                                </operationBindings>
                            Next is the code that is applied to the selectItem presented to the user on a form. These criteria values have to be applied at the last moment and cannot be built into the whereClause beforehand. In my case when the the form becomes visible.
                            Code:
                            this.getField("TEAMMEMBERID").setProperty("cachePickListResults",false);
                            	
                            this.getField("TEAMMEMBERID").optionCriteria = {"PROJECTID" : Application.currentProjectID, 
                            								 "COMMUNITYID" : Application.currentCommunityID } ;
                            The key to this is the Stakeholder.TEAMMEMBERID IS NULL. This pulls out of the join of all possible Stakeholder assignments all the ones that are NOT currently assigned.

                            NOTE: PROJECTID does not have to be declared as a field in the TeamMember dataSource. Neither do the Stakeholder fields referenced. COMMUNITYID is part of the whereClause to limit the scope of the possible assignments. It prevents TeamMembers from another Community being listed.

                            NOTE ALSO: the Organization table is present just to pick up an ORGANIZATIONNAME using an ORGANIZATIONID field present in the TeamMember table and dataSource. It is not involved in the operation of the join.

                            I also attached a diagram with a simplistic look at the relationships involved.

                            With isomorphic looking over my shoulder, I think this closes my thread.

                            Your Humble Hacker,

                            Rick
                            Attached Files

                            Comment

                            Working...
                            X