Question on Query Related Records

283
1
04-19-2012 01:13 AM
ArchanaSahu
New Contributor
How can I query a stand-alone table using query attribute task on android?

e.g my map service includes an EMPLOYEE (containing non-spatial data) table and BUILDING layer (spatial data) which are RELATED many-to-one (one building on a university campus can have many employees working--such as faculty and staff) . Can I query EMPLOYEE table to find which BUILDING an employee works for?

What I want is if user types in a faculty name in a text field for example and click on SEARCH button beside it, the result should display (highlight) the BUILDING on map where he works. I know I have to use RelationshipQuery somewhere. But, how do I get the OBJECTID of the NAME user enters in text field (although I do have OBJECTID, NAME,... and some other columns in my EMPLOYEE table) to set the RelationshipQuery.

Can anybody who has developed this kind of application please help me with sample code? I am fairly new to android application development. So, any help will be greatly appreciated.

I have started like as follows, but don't know how to proceed.

            String targetServerURL = "http://10.129.141.119:8399/arcgis/rest/services/IITBMobileCampusGIS/MapServer/12";

            RelationshipQuery query = new RelationshipQuery();
            query.setObjectIds(new int[] {?????});  //HOW TO obtain ObjectID from the name provided by user in the text field
            query.setRelationshipId(0);
            query.setReturnGeometry(true);
            query.setOutFields(new String[] {"*"});
          
            QueryTask queryTask = new QueryTask(targetServerURL);

Thanks,
Archana
0 Kudos
1 Reply
piyush_ramdaspb
New Contributor
Hi,
I am facing same problem can you help me out of this...

thanks and regards
0 Kudos