// definitionExpression for featurelayer var definitionExpression:String = obj.@definitionexpression[0] ? obj.@definitionexpression : "";
// definitionExpression for featurelayer var definitionExpression:String; if(FlexGlobals.topLevelApplication.strUsername != "" && label == "My Layer that I want the definition for"){ definitionExpression = "Creator = " + FlexGlobals.topLevelApplication.strUsername; }else{ definitionExpression = obj.@definitionexpression[0] ? obj.@definitionexpression : ""; }
Ashwini, So there are a lot of variables here... Is the layer that you want to apply a definitionexpression to a base map or an operational layer and how will you determine which layer to apply it to?Is the strUsername a public var in the index.mxml?Have you already tested that you are properly getting the strUsername based on the user logged in?You would need to modify the ConfigManager.as in the getLayerObject function there are these lines: // definitionExpression for featurelayer var definitionExpression:String = obj.@definitionexpression[0] ? obj.@definitionexpression : "";you would need to replace with something like this: // definitionExpression for featurelayer var definitionExpression:String; if(FlexGlobals.topLevelApplication.strUsername != "" && label == "My Layer that I want the definition for"){ definitionExpression = "Creator = " + FlexGlobals.topLevelApplication.strUsername; }else{ definitionExpression = obj.@definitionexpression[0] ? obj.@definitionexpression : ""; }If you are not confident in your programming abilities, then I would suggest not attempting this. There is nothing worse for people like me than to try and provide code for someone and they have no clue what it is doing or where exactly to put it or they introduce syntax errors by changing something they don't understand.
import mx.core.FlexGlobals;
Ashwini, You will also need to add this import to the ConfigManager.as:import mx.core.FlexGlobals;
fLayer.definitionExpression = "Ward_No = '" + FlexGlobals.topLevelApplication.parameters.ward_number + "'";
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.