Skip to content

Commit

Permalink
FeatureLayer Query sample - Format search terms (#346)
Browse files Browse the repository at this point in the history
* FeatureLayer Query remove white space from search term

* Format search terms in QueryFeature Layer
  • Loading branch information
semcilreavy authored Nov 7, 2017
1 parent 9528945 commit 271082d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private async Task QueryStateFeature(string stateName)
QueryParameters queryParams = new QueryParameters();

// Construct and assign the where clause that will be used to query the feature table
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.ToUpper()) + "%'";
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.Trim().ToUpper()) + "%'";

// Query the feature table
FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ private async Task QueryStateFeature(string stateName)
// Create a query parameters that will be used to Query the feature table
QueryParameters queryParams = new QueryParameters();

// Trim whitespace on the state name to prevent broken queries
String formattedStateName = stateName.Trim().ToUpper();

// Construct and assign the where clause that will be used to query the feature table
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.ToUpper()) + "%'";
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

// Query the feature table
FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ private async Task QueryStateFeature(string stateName)
// Create a query parameters that will be used to Query the feature table
QueryParameters queryParams = new QueryParameters();

// Trim whitespace on the state name to prevent broken queries
String formattedStateName = stateName.Trim().ToUpper();

// Construct and assign the where clause that will be used to query the feature table
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.ToUpper()) + "%'";
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

// Query the feature table
FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ private async Task QueryStateFeature(string stateName)
// Create a query parameters that will be used to Query the feature table
QueryParameters queryParams = new QueryParameters();

// Trim whitespace on the state name to prevent broken queries
String formattedStateName = stateName.Trim().ToUpper();

// Construct and assign the where clause that will be used to query the feature table
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.ToUpper()) + "%'";
queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

// Query the feature table
FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);
Expand Down

0 comments on commit 271082d

Please sign in to comment.