Skip to main content

ZoomToFeature from Home Panel?

Comments

11 comments

  • Kevin Penner

    Hi Laura,

    You could launch a workflow from your home panel by using a hyperlink command.

    Here is a sample of the HTML you would need to put in your home panel:

    <a href="command:RunWorkflowWithArguments?workflowId=ZoomToFeatureById&featureId=123">Go to point 123</a>

    Inside the ZoomToFeatureById workflow you could do a query for a feature with id 123 and then pan/zoom to the geometry of the found feature.

    Let me know how it goes!

    Cheers,

    Kevin

     

     
    0
  • Permanently deleted user

    Hi Kevin,

    Would this mean that I would need to create a seperate workflow for each individual object I wanted to ZoomTo?

    Thank You,

    Laura

    0
  • Kevin Penner

    It would be easiest if all the features were in the same layer, then you would just change the ID argument accordingly.

    If the features are in multiple layers than you could create a workflow with one or two extra parameters, say 'LayerName', 'Id' and 'IdField'. The query activity then uses the passed info to return a feature.

    Cheers,

    Kevin

    0
  • Permanently deleted user

    Hi Kevin,

    I think this is going to work great since all the data is coming from the same layer!

    However when I setup my WHERE query, how do I write it so it includes the passed in variable (such as 123) from the hyperlink?

    Thanks again!

    Laura

    0
  • Kevin Penner

    Either right in the query task or in an assign above.

    For string datatypes: "FeatureNameField = '" +YourWorkflowArgumentName + "'"

    For numeric datatypes: "FeatureIdField = " + YourWorkflowArgumentId

    There are other fancy ways to handle both types, but try those for now.

    -Kevin

    0
  • Kevin Penner

    Make sure you check that the query is returning a feature. When you try to access featuresset.features(0) and nothing is there, it will cause this error.

    0
  • Permanently deleted user

    The problem is that it's not getting the variable from the <a href="command:RunWorkflowWithArguments?workflowId=ZoomTo&featureId=1">Go to point 1</a> statement. I setup an Alert at the beginning of the workflow to print the featureId variable and it's saying "There was a workflow error running activity: Exception has been thrown by the target of an invocation. Workflow 'ZoomTo' failed Unhandled exception: 'Object reference not set to an instance of an object.' in activity '1.50: Alert'. Object reference not set to an instance of an object."

     

    0
  • Kevin Penner

    Can you paste your site config for the link?

    0
  • Permanently deleted user

    You mean my Home Panel code? I just wanted to check before posting because it's rather lengthy.

    0
  • Permanently deleted user

    After reading this thread: https://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=20&thread=53580

    I created an Argument for featureID, however now i'm getting the following error: There was a workflow error running activity: Exception has been thrown by the target of an invocation. Unable to load workflow. Cannot set unknown member '{clr-namespace:}_218e.featureID'.

    Has anyone seen the message before? I'm trying to run this on an HTML5 site, will this function only work in the Silverlight viewer?

    Thank You,

    Laura

    0
  • Permanently deleted user
    Hi Robin,   have you figured this ZoomToFeaturebyid workflow out? any possible that you can share the code?

     

    Thanks.

     

    Feng
    0

Please sign in to leave a comment.