How to set multiple conditions in definition expression of a feature layer

Discussion created by niranjan_borawake on Oct 28, 2013
Latest reply on Oct 28, 2013 by niranjan_borawake
When I set definition expression of a county layer to
countyLayer.setDefinitionExpression("STATE_FIPS = '" + fips + "'");
only the counties in state with FIPS as
are rendered.

Now, what I need to do is render all the blocks inside a county of a state. Block group layer has STATE_FIPS (length 2 ) and CNTY_FIPS (length 3). If I set definition expression to
blockLayer.setDefinitionExpression("CNTY_FIPS = '" + countyFips + "'");
, this will render blocks inside county with CNTY_FIPS = countyFips. But, since CNTY_FIPS is of length 3 and this expression matches for county in every state and blocks inside all the counties of the states are rendered.

I am trying or rather what I need to do is
blockLayer.setDefinitionExpression("CNTY_FIPS = '" + countyFips + "' AND STATE_FIPS = '" + fips + "'");

This way only blocks inside a state with STATE_FIPS = fips will be renedered. But combining expression with AND does not work.

Any help would be apreciated. Thanks in advance.