Select to view content in your preferred language

getting invalid or missing input parameters error

7166
2
Jump to solution
06-17-2013 05:16 AM
DeewendraShrestha
Occasional Contributor
Hello there, I am using flex viewer 3.1, and was trying out "query for statistics" example at :http://resources.arcgis.com/en/help/flex-api/samples/index.html#//01nq00000070000000
I modified the code a bit so that the data can be viewed in the datagrid(and I don't need to do fancy stats stuff), but I am getting "Invalid or missing input parameters error".
Here is my full mxml file content
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"                    xmlns:s="library://ns.adobe.com/flex/spark"                    xmlns:mx="library://ns.adobe.com/flex/mx"                    xmlns:viewer="com.esri.viewer.*"        xmlns:esri="http://www.esri.com/2008/ags"                    widgetConfigLoaded="init()">     <fx:Script>         <![CDATA[    import com.esri.ags.events.QueryEvent;    import com.esri.ags.tasks.supportClasses.Query;    import com.esri.ags.tasks.supportClasses.StatisticDefinition;        import mx.collections.ArrayCollection;    import mx.controls.Alert;    import mx.events.FlexEvent;    import mx.rpc.events.FaultEvent;                 //this function called when the widget's configuration is loaded             private function init():void             {                   var query:Query = new Query();     //query.where = "STATE_NAME = 'Alaska' AND TYPE = 'city'";     query.returnGeometry = false;     query.outFields = ["STATE_NAME"];     queryTask.execute(query);             }        protected function queryTask_executeCompleteHandler(event:QueryEvent):void    {     var fields:Array = event.featureSet.fields;     var attributes:Array = event.featureSet.attributes;     dg.dataProvider = new ArrayCollection(attributes);    }        protected function esri_faultHandler(event:FaultEvent):void    {     Alert.show("Error: " + event.fault.faultString, "Error code: " + event.fault.faultCode);    }        protected function sumLabelFunction(item:Object, column:GridColumn):String    {     return numberFormatter.format(item["POP_SUM"]);    }             ]]>     </fx:Script>  <fx:Declarations>   <!-- Query Task -->   <esri:QueryTask id="queryTask"       executeComplete="queryTask_executeCompleteHandler(event)"       fault="esri_faultHandler(event)"       url="http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1"/>      <s:NumberFormatter id="numberFormatter" trailingZeros="false"/>     </fx:Declarations>          <viewer:WidgetTemplate id="frTable"                            width="500" height="500">         <viewer:layout>             <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>         </viewer:layout>      <s:DataGrid id="dg"      width="280"      right="20" top="20">    <s:columns>     <s:ArrayList>      <s:GridColumn dataField="STATE_NAME" headerText="US State"/>          </s:ArrayList>    </s:columns>   </s:DataGrid>         </viewer:WidgetTemplate> </viewer:BaseWidget> 


When I manually query http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1, I can see the STATE_NAME attribute and values. Please help me out on figuring out what I am doing wrong. Thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GISDev1
Deactivated User
Hello there, I am using flex viewer 3.1, and was trying out "query for statistics" example at :http://resources.arcgis.com/en/help/flex-api/samples/index.html#//01nq00000070000000
I modified the code a bit so that the data can be viewed in the datagrid(and I don't need to do fancy stats stuff), but I am getting "Invalid or missing input parameters error".
Here is my full mxml file content
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"                    xmlns:s="library://ns.adobe.com/flex/spark"                    xmlns:mx="library://ns.adobe.com/flex/mx"                    xmlns:viewer="com.esri.viewer.*"        xmlns:esri="http://www.esri.com/2008/ags"                    widgetConfigLoaded="init()">     <fx:Script>         <![CDATA[    import com.esri.ags.events.QueryEvent;    import com.esri.ags.tasks.supportClasses.Query;    import com.esri.ags.tasks.supportClasses.StatisticDefinition;        import mx.collections.ArrayCollection;    import mx.controls.Alert;    import mx.events.FlexEvent;    import mx.rpc.events.FaultEvent;                 //this function called when the widget's configuration is loaded             private function init():void             {                   var query:Query = new Query();     //query.where = "STATE_NAME = 'Alaska' AND TYPE = 'city'";     query.returnGeometry = false;     query.outFields = ["STATE_NAME"];     queryTask.execute(query);             }        protected function queryTask_executeCompleteHandler(event:QueryEvent):void    {     var fields:Array = event.featureSet.fields;     var attributes:Array = event.featureSet.attributes;     dg.dataProvider = new ArrayCollection(attributes);    }        protected function esri_faultHandler(event:FaultEvent):void    {     Alert.show("Error: " + event.fault.faultString, "Error code: " + event.fault.faultCode);    }        protected function sumLabelFunction(item:Object, column:GridColumn):String    {     return numberFormatter.format(item["POP_SUM"]);    }             ]]>     </fx:Script>  <fx:Declarations>   <!-- Query Task -->   <esri:QueryTask id="queryTask"       executeComplete="queryTask_executeCompleteHandler(event)"       fault="esri_faultHandler(event)"       url="http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1"/>      <s:NumberFormatter id="numberFormatter" trailingZeros="false"/>     </fx:Declarations>          <viewer:WidgetTemplate id="frTable"                            width="500" height="500">         <viewer:layout>             <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>         </viewer:layout>      <s:DataGrid id="dg"      width="280"      right="20" top="20">    <s:columns>     <s:ArrayList>      <s:GridColumn dataField="STATE_NAME" headerText="US State"/>          </s:ArrayList>    </s:columns>   </s:DataGrid>         </viewer:WidgetTemplate> </viewer:BaseWidget> 


When I manually query http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1, I can see the STATE_NAME attribute and values. Please help me out on figuring out what I am doing wrong. Thanks.


Try a where clause of 1=1. You definitely need the where clause uncommented. I don't see a field for City in that Service so that could be causing an issue with that query.

View solution in original post

0 Kudos
2 Replies
GISDev1
Deactivated User
Hello there, I am using flex viewer 3.1, and was trying out "query for statistics" example at :http://resources.arcgis.com/en/help/flex-api/samples/index.html#//01nq00000070000000
I modified the code a bit so that the data can be viewed in the datagrid(and I don't need to do fancy stats stuff), but I am getting "Invalid or missing input parameters error".
Here is my full mxml file content
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"                    xmlns:s="library://ns.adobe.com/flex/spark"                    xmlns:mx="library://ns.adobe.com/flex/mx"                    xmlns:viewer="com.esri.viewer.*"        xmlns:esri="http://www.esri.com/2008/ags"                    widgetConfigLoaded="init()">     <fx:Script>         <![CDATA[    import com.esri.ags.events.QueryEvent;    import com.esri.ags.tasks.supportClasses.Query;    import com.esri.ags.tasks.supportClasses.StatisticDefinition;        import mx.collections.ArrayCollection;    import mx.controls.Alert;    import mx.events.FlexEvent;    import mx.rpc.events.FaultEvent;                 //this function called when the widget's configuration is loaded             private function init():void             {                   var query:Query = new Query();     //query.where = "STATE_NAME = 'Alaska' AND TYPE = 'city'";     query.returnGeometry = false;     query.outFields = ["STATE_NAME"];     queryTask.execute(query);             }        protected function queryTask_executeCompleteHandler(event:QueryEvent):void    {     var fields:Array = event.featureSet.fields;     var attributes:Array = event.featureSet.attributes;     dg.dataProvider = new ArrayCollection(attributes);    }        protected function esri_faultHandler(event:FaultEvent):void    {     Alert.show("Error: " + event.fault.faultString, "Error code: " + event.fault.faultCode);    }        protected function sumLabelFunction(item:Object, column:GridColumn):String    {     return numberFormatter.format(item["POP_SUM"]);    }             ]]>     </fx:Script>  <fx:Declarations>   <!-- Query Task -->   <esri:QueryTask id="queryTask"       executeComplete="queryTask_executeCompleteHandler(event)"       fault="esri_faultHandler(event)"       url="http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1"/>      <s:NumberFormatter id="numberFormatter" trailingZeros="false"/>     </fx:Declarations>          <viewer:WidgetTemplate id="frTable"                            width="500" height="500">         <viewer:layout>             <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>         </viewer:layout>      <s:DataGrid id="dg"      width="280"      right="20" top="20">    <s:columns>     <s:ArrayList>      <s:GridColumn dataField="STATE_NAME" headerText="US State"/>          </s:ArrayList>    </s:columns>   </s:DataGrid>         </viewer:WidgetTemplate> </viewer:BaseWidget> 


When I manually query http://it.innovateteam.com/arcgis/rest/services/OTIS/TestWebServiceForQueries/MapServer/1, I can see the STATE_NAME attribute and values. Please help me out on figuring out what I am doing wrong. Thanks.


Try a where clause of 1=1. You definitely need the where clause uncommented. I don't see a field for City in that Service so that could be causing an issue with that query.
0 Kudos
DeewendraShrestha
Occasional Contributor
Try a where clause of 1=1. You definitely need the where clause uncommented. I don't see a field for City in that Service so that could be causing an issue with that query.


Awesome, thanks for the rescue. I had copied the query.where part from one of the samples and I didn't need it so I just left it commented.
0 Kudos