conditional statements in long description
Hello,
Is there a way to have conditional statements within a long description? Or change what fields are displayed in the Details section based on a field value?
I am recreating a Cemetery Viewer in HTML Viewer to replace an old Flex based app (that wasn't GC related).
I would like to be able to do something like...
If {field}=true then
set the long description
else
set the long description to something else.
Is this possible?
0
-
Carmen,
I dont think that kind of conditional logic is supported. I have a work-around that I have used several times, which may work for you. I use a query layer in my map service instead of a featrue class and put the conditional logic into the sql that creates the query layer.
I use a CASE statement to create a virtual field that stores the desired values. Something like below:
Select OBJECTID, Shape, CASE WHEN [fieldA] = 'x' THEN 'Good' WHEN [fieldA] = 'y' THEN 'OK' ELSE 'Poor' END AS 'Field Name' FROM Carta.GIS.Inspections
The new field 'Field Name' is then part of the data source and can be used in long description.
Note, that query layers work only with SDE data sources and also, not supported in feature services. Other than those restrictions they are great for map services.0
Please sign in to leave a comment.
Comments
1 comment