How to reference the current site in a workflow?
I have found some code which would allow me to loop through the layers of a map service in a site and determine if they are visible or not. We need this list of what is visible in order to determine what gets extracted by a geoprocessing tool. There are over 100 layers in the site, so hardcoding every single layer into the workflow to get it's visibility seems like a really backwards and inefficient way to do this, especially when the layers in the viewer can change from time to time. Just a bad coding practice in general.
I have this code:
For Each mapService As Geocortex.Essentials.Client.MapService In _EssentialsSite.EssentialsMap.MapServices
Dim visibleLayerIDList As New List(Of Integer)()
For Each l As Geocortex.Essentials.Client.Layer In mapService.Layers
If l.IsVisible = True AndAlso l.Identifiable = True Then
Dim i As Integer = Convert.ToInt32(l.ID.ToString())
visibleLayerIDList.Add(i)
End If
Next
Next
return visibleLayerIDList
When it is run I get tis error:
There was a workflow error running activity: Exception has been thrown by the target of an invocation. Workflow 'GP DWG Extractor' failed Unhandled exception: ''_EssentialsSite' is not declared. It may be inaccessible due to its protection level. ' in activity '1.59: VBScript'. '_EssentialsSite' is not declared. It may be inaccessible due to its protection level.
How can I get a reference to the site? I saw some documentation from 2013 that said Geocortex would never expose the site object to allow users to get to it within a workflow, so I don't know if this is even possible.
Thanks
Tami O
0
-
Hi Tami,
Have you considered using the GetMapInfo workflow activity in combination with the GetMapServiceInfo activity? The GetMapInfo activity has an output parameter "MapServiceIds" (only visible in the "Properties" menu to the right) which returns a list of all of the map service ids which are referenced in your site. The GetMapServiceInfo activity takes a MapServiceID as input and has a boolean output parameter for "Visible".
Using this approach you can iterate through all of your MapServiceID's (using a ForEach activity) and retreive their visibility status with the GetMapServiceInfo workflow activity. By using an "If" activity inside of the ForEach you could for example construct a list of all of the MapServicesIDs where Visible = True.
Hope this helps!
-Scott0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
1 kommentar