Hoppa till huvudinnehållet

How can I have a default selection in a form listbox?

Kommentarer

6 kommentarer

  • Zack Robison
    Yup!  Assignment in the runtime modifications, you're good! :) I think that you'll want to provide the selected dataItem to the .SelectedValues parameter, but I could be mistaken about the dataItem... the property might take a list of values or something.
    0
  • Permanently deleted user
    Thanks. The logic is fiarly straight forward, but my problem is I have no idea about the syntax or how to find/set the right properties as I can't find an example. Any hints on that?
    0
  • John Nerge
    If you just want to set a single, default selected value based on a string, it's a lot easier to do with a ComboBox. Setting the selected value/s for the listbox is a little trickier because you need an IList<Object> variable to use in your runtime modification. Here is a simple workflow demonstrating both:

     

    https://drive.google.com/open?id=0B_hHHiqcTKMfaHFBUXdYdVY4M1E

     

    *Note - the ListBox selected value won't work in the workflow simulator. You have to add this workflow to a GE site/viewer in order to see if work correctly.

     

    Also, for your reference, in Workflow Designer, you can right click on any activity and open help documentation for it. In the case of Display Form, if you scroll down there's a nice long section of Commonly-User Properties for Build-in Form Items, including the syntax for specifying the selected value for a listbox.
    0
  • Permanently deleted user
    Thanks! Mine has to be a listbox because of multiple selections needed. I'll check the example, much appreciated!
    0
  • Zack Robison
    FYI If you're ever looking to find out what class of object a property like this is looking for, here's the trick I use. 

     

    Set the L-side value of an assignment activity to be what you'll want it to be, and click on the R-side.  If intellisense is turned off in your workflow designer, the R-side often will then provide a list of variables at the top of which is a suggestion for an expression that would provide the type of input required (something like "New List(Of String)" or whatever).

     

    While that doesn't always work, it is fast.  A one-click longer option: there is a "create variable" option in that dropdown list mentioned earlier. If you click on that value then the pre-filled variable type will almost always provide what you're looking for (in this case, an IEnumerable(Of Object)).  It's a bit wonky, but it goes a long way to figuring things out without needing to open the api documentation.
    0
  • Permanently deleted user
    John Nerge - Thanks for the sample, it helped a lot!
    0

Du måste logga in om du vill lämna en kommentar.