Select to view content in your preferred language

query rest from flexviewer

1043
4
06-23-2011 06:07 AM
SaugatJoshi
Deactivated User
Hi,

Is there a way to get the drawing info from the rest service back to the flex viewer. i want to get
Symbol:
Style: esriSLSSolid, Color: [46, 0, 130, 255], Width: 1.0

from REST endpoint to the flex viewer.

Thanks.
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   Sure it is as simple as:

var httpServ:HTTPService = new HTTPService();
                    httpServ.url = "http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/LocalGovernment/Events/MapServer/0?f=json";
                    httpServ.resultFormat = "text";
                    httpServ.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void{processLayerDetails(event)});
                    httpServ.send();

private function processLayerDetails(event:ResultEvent):void
        {
            const rawData:String = String(event.result);
            const data:Object = JSON.decode(rawData);
            //do some thing with the data object
        }
0 Kudos
SaugatJoshi
Deactivated User
Thank you Robert, that helped. One quick question even this does not relate to the above issue. I have 100 tables published as map service in REST endpoint. Each table has different project ID. For eg:project id:20 is present in all tables. I want to display the layers with project ID=20 from all the tables on top of the basemap. It would be great help if you could hint me as how I should proceed.

Thank you.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   I can't say that I understand your question at all...:confused:
0 Kudos
SaugatJoshi
Deactivated User
Sorry Robert I have a REST endpoint as...

Layers:
agistion (0)
agistand (1)
agislight (2)
agiscontrolpoint (3)
agissign (4)
agisssite (5)
agisesite (6)
agispment (7)
agisbuoy (8)
agiscident (9)
.
.
.
.
agisent (100)

Fields associated with each layer.
Fields:
project_id ( Type: esriFieldTypeInteger, Alias: transformation_transaction_id )
feature_id ( Type: esriFieldTypeString, Alias: feature_id , Length: 64 )
feature_type ( Type: esriFieldTypeString, Alias: feature_type , Length: 30 )
alternative ( Type: esriFieldTypeInteger, Alias: alternative )
description ( Type: esriFieldTypeString, Alias: description , Length: 255 )

Now each of these layer have number of projects associated. for eg: agistion (0) has project id =20,40,123 associated with it. I want to filter out the only those with project id= 20, from all the 100 layers and have it on the flex viewer,such that the widgets can use it. I used find task to achieve this but it requires layer ID to be written as well as the widgets do not work. Since the number of layer may change in time I do not think this is feasible as well.

Could you hint me as how I should proceed to this. May be some python script or what not. I really appreciate your feedback.

Thank you.
0 Kudos