Select to view content in your preferred language

Selection Widget for SFV2.2 (with a query builder)

6616
50
02-21-2011 11:55 AM
MarkHoyland
Occasional Contributor II
The Selection widget has a "Select by Attributes" and "Select by Location" option similar to ArcGIS.
It has options where you can set your selection type eg New Selection, Add to Selection, Remove from Selection.
Select from multiple layers that interstect/contain etc another layer.
You can view the results for each layer in a datagrid, and export to tab delimited text file.

Widget link: http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8

I built this because it seemed like a fun project and the temptation of a Flex a Widget T-shirt was too much to resist.:o

If you download please leave feedback and rate the widgets (this should apply to any widget you download) as the feed back really helps to know what users are after.
Tags (2)
0 Kudos
50 Replies
JesseMetcalfe
New Contributor
Hi Mark,
Its been really a great widget and I appreciate you guys hard work to support this vast community of Viewer application for their day to day work.

Actully I am trying to modify this widget to suit my requirement.
when querying a field I want user to allow to
- select multiple values from the list
- do not want to give options for selecting operators.
so my query will always be

"select * from <layer> where <fld1> = "selection1" OR "selection2"

Pls. give me some pointers. It will be really helpfull.

Jesse
0 Kudos
francescodi_vito
Deactivated User
Hi Mark
for "available for the public" you mean if my Map Service have a password?
The filed YES or NO it's text field.
the error is "TypeError: Error # 1009: Can not access a property or method of a null object reference."
here attached 2 pictures of widget when i run the selection for YES and NO
0 Kudos
xandermavrides
New Contributor III
Where/How can I change the color of the selection results grid? I'd like a bit more contrast in the results. It's currently white text with an off-white background.

I'm not seeing it in the mxml. Or perhaps is based on the style tags set in the config.xml????

Thanks.
0 Kudos
MarkHoyland
Occasional Contributor II
Xander,

I think you have to look into styling. I dont apply any styling so it just uses the default FlexViewer style.
http://help.arcgis.com/en/webapps/flexviewer/help/Default.htm#CSHID=styling.htm|StartTopic=styling.h...

If you are still unsure post a new thread about styling a datagrid in flex viewer, and I am sure others would be able to help.
0 Kudos
JesseMetcalfe
New Contributor
Is their a way If I can provide aliases for fields to build the query ?

I want to modify this widget to suit my requirement.

when querying a field I want user to allow to
- select multiple values from the list
- do not want to give options for selecting operators.
so my query will always be

"select * from <layer> where <fld1> = "selection1" OR "selection2"
I am successful in populating the Unique values List when I select any field and able to select Multiple values from the list.

Please suggest ?
0 Kudos
francescodi_vito
Deactivated User
Hi Mark,
in this pisctures that i attached in this message, there is a error that i have. i Have this error when i run the selection widget for NO field
0 Kudos
MarkHoyland
Occasional Contributor II
francesco,
Are you able to copy and paste that message, and post it here?
Otherwise I need you scroll across the message window, and grab another picture, so I can see the right hand side of the message.
It is probably the second and third line of that message that I need to see.

ps. By publicly available(previous post), I mean can I put your mapservice into my project, or is it only available within your intranet.
0 Kudos
MarkHoyland
Occasional Contributor II
Jesse,
What you want is possible, You would have to redesign the Graphic Interface a bit.
The selection statement that you need is:

"select * from <layer> where <fld1> = "selection1" OR <fld1> = "selection2"

Notice you have to include the field name for each selection.

Another possible query is: where <fld1> in ("selection1" ,"selection2")
I am not able to test at the moment but it might get you started.
0 Kudos
francescodi_vito
Deactivated User
Hi Mark! Sorry But my map service is only available on the intranet! Now I'm using uncompiled version and in FV property i set a 10.2 flash player version that i use,and when i run the selection with a 'NO' value the datagrid is not fill and on the map there is the result of selection, But if i zoom in the datagrid is immediatelly filled But the clear button and export button and zoom button are not available? Why? Obvously the error message has disappered! Please help me
0 Kudos
JesseMetcalfe
New Contributor
Thanks Mark,
I am able to implement the functionality.
However now I want to perform Definition Query on the selected criteria.
So below is my code Snippet -

In SelectByAttributes.mxml - I m setting definitionExpression and calling refresh on target layer.
But It is only showing me busy cursor.

Is it possible if I can detach the "Selection Results" table from the widget ?
Pls help.

protected function selectBtn_clickHandler(event:MouseEvent):void
{
this.cursorManager.setBusyCursor();
var query:Query = new Query;
query.where = queryFilter.text;
targetLayer.definitionExpression = queryFilter.text;
targetLayer.refresh();

//targetLayer.selectFeatures(query, selectionMethod, new AsyncResponder(onSelectResult, onSelectFault, targetLayer));
}

Jesse
0 Kudos