I am running SmartClient Version: SmartClient_v8.2p_2012-06-08/EVAL (Deployment 2012-06-08) on Mozilla Firefox 3.6.18 with Firebug using Windows XP Pro 32 bit.
For a SelectItem I need to do a negative join. I want to show a list of teammembers to add to a list of stakeholders that are not already a stakeholder. This needs a special fetch, and the cache needs to be invalidated each time.
Before I open the window with the FormItem I call TeamMember.invalidateCache for the datasource and also for the formitem display values. When I show the window, for the FormItem I get an RPCrequest that fetches all the TeamMembers (even though I have turned off AutoFetchData).
This has a DSrequest:
I don't mind this, because when the form loads I catch visibilityChanged and try to invalidate the cache again. Then I force a fetchData with an operationId to "excludeCurrentStakeholders".
This is the result
I notice in the RPC list that this last entry shows "[client only]" in the URL. This seems to be ignoring the call to throw away the cache and use the operationId. This agrees with the result because, I get all the TeamMembers every time in the drop down list.
Here is the ds.xml
and the code on the button
The server log agrees with the RPC log. There is no fetch with the operationId. It is attached.
I can test around this by just not selecting to add a duplicate. But, I cannot find a work around in code.
I appreciate the attempt at optimization by using the cache a lot. But, I need to turn it off somehow in this instance.
I little help would go a long way.
Thanks,
Rick
For a SelectItem I need to do a negative join. I want to show a list of teammembers to add to a list of stakeholders that are not already a stakeholder. This needs a special fetch, and the cache needs to be invalidated each time.
Before I open the window with the FormItem I call TeamMember.invalidateCache for the datasource and also for the formitem display values. When I show the window, for the FormItem I get an RPCrequest that fetches all the TeamMembers (even though I have turned off AutoFetchData).
Code:
{ "actionURL":"http://localhost:8080/isomorphic/IDACall", "showPrompt":true, "transport":"xmlHttpRequest", "promptStyle":"dialog", "bypassCache":true, "data":{ "criteria":null, "operationConfig":{ "dataSource":"TeamMember", "repo":null, "operationType":"fetch" }, "appID":"builtinApplication", "operation":"TeamMember_fetch", "oldValues":null, "streamResults":null, "exportToFilesystem":null, "exportToClient":null } }
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" }
Code:
if (this.isVisible()) { this.getField("TEAMMEMBERID").fetchMissingValues = true; this.getField("TEAMMEMBERID").alwaysFetchMissingValues = true; this.getField("TEAMMEMBERID").optionOperationId = "excludeCurrentStakeholders"; this.getField("TEAMMEMBERID").optionCriteria = {'Project.ProjectID': Application.currentProjectID, 'Stakeholder.CommunityID': Application.currentCommunityID, 'TeamMember.CommunityID': Application.currentCommunityID}; this.getField("TEAMMEMBERID").invalidateDisplayValueCache(); this.getField("TEAMMEMBERID").fetchData(function (dsItem, dsResponse, dsData, dsRequest) {isc.say("this.getField(TEAMMEMBERID).fetchData " + this.echo(dsRequest));}, {operationId: "excludeCurrentStakeholders", operationType: "fetch"}); }
Code:
{ "actionURL":"http://localhost:8080/isomorphic/IDACall", "showPrompt":false, "prompt":"Finding records that match your criteria...", "transport":"xmlHttpRequest", "promptStyle":"dialog", "params":{ "Project.ProjectID":101, "Stakeholder.CommunityID":101, "TeamMember.CommunityID":101 }, "httpMethod":"GET", "bypassCache":true, "callback":{ "target":[DataSource ID:TeamMember], "methodName":"$50e" }, "willHandleError":true, "clientContext":{ "requestIndex":1, "$69t":null }, "data":null }
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" }
Here is the ds.xml
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>
Code:
if (!window.ProjectStakeholderWindow) { var message = "Component ID \"ProjectStakeholderWindow\", target of action \"Show\" does not exist"; isc.Log.logWarn(message); if (isc.designTime) { isc.say(message); } } var form = ProjectStakeholderForm; form.clearValues(); form.setValue("COMMUNITYID", Application.currentCommunityID); form.setValue("PROJECTID", Application.currentProjectID); form.setValue("PROJECTADMIN", false); form.rememberValues(); form.setSaveOperationType("add"); form.getItem("SaveButton").setDisabled(true); form.getItem("UndoButton").setDisabled(true); TeamMember.invalidateCache(); ProjectStakeholderWindow.show(); ProjectStakeholderWindow.setTitle("New Stakeholder for Project " + Application.currentProjectNumber + ": " + Application.currentProjectTitle);
I can test around this by just not selecting to add a duplicate. But, I cannot find a work around in code.
I appreciate the attempt at optimization by using the cache a lot. But, I need to turn it off somehow in this instance.
I little help would go a long way.
Thanks,
Rick
Comment