cancel
Showing results for 
Search instead for 
Did you mean: 

Pass list into a form property

jwistrom
Champ in-the-making
Champ in-the-making
Hi
I am rather new to Activiti but I have some knowledge. I am using Vaadin to render the forms. I have created my own fields for rendering. Now I want to create a form property (or something) so I can render a component with two tables (available values and assigned values) in the Bpmn xml I want to be able to specify a list of available values and the table of assigned values should be the values already selected in the corresponding process variable (this will be a recurring task)
How would I go about to accomplish this?

Very greatful for any answers

Regards
Johan
9 REPLIES 9

trademak
Star Contributor
Star Contributor
Hi Johan,

You would need to store the variables in the process context in the form field type converter.

Best regards,

jwistrom
Champ in-the-making
Champ in-the-making
Thank you. I will see what I can do about it. Do you know of any example I can look at? I am not so experienced so I haven't heard of "form field converter"

trademak
Star Contributor
Star Contributor

jwistrom
Champ in-the-making
Champ in-the-making
Hi
From what I understand. The Date converter parses the string to a date format. In my case i pass in an expression that returns a list. How do I parse the string I pass in to an expression and then execute the expression in my custom form type (or custom form field)?

Best Regards

jbarrez
Star Contributor
Star Contributor
Pretty much the same way as the date, you just need to decide on a way to store the list as a string and then serialize/deserialize when needed.

jwistrom
Champ in-the-making
Champ in-the-making
Don't I need to pass in the list with the extension activiti:value in the xml? If so, what I understand expression can not be passed in, right? Isn't the date pattern passed in that way?

Regards
Johan

jbarrez
Star Contributor
Star Contributor
You would indeed need something like
<code>
<activiti:value id="left" name="Go Left" />
</code>
and then in the FormType implementation do something like .getInformation("left")

jwistrom
Champ in-the-making
Champ in-the-making
Then I will pass in a String right? If I pass in an expression, say
<code>${1+1}</code>

I have done like this in my custom form type.

<code>
for(FormValue fv : formProperty.getFormValues()){
         if (fv.getId().equals("myId")){
            myExpression = fv.getName();
         }
      }
</code>

But how do I interpret the incoming string as an expression because I do not get 2 in my form values, I get the string "${1+1}"

Rgds
Johan

jbarrez
Star Contributor
Star Contributor
Hmm you would to make it an Expression object, from the String (get the ExpressionManager from the ProcessEngineConfiguration), but you would need something to resolve it against (eg an execution).