Table widget

Hi all,

I’m having a difficult time with the table widget… Any help would be appreciated.
I’m using 6.3.3 subscription.

I have a custom data type => a complex java object data in my process. I’ve already loaded values into my process data (expenseClaimItems), and I wan’t to show them in a table widget.

I’ve configured this widget data information as expression (“Edit as an expression”, as opposite as “Edit with table”), and wrote a groovy expression (return type java.util.List) to get the values:

import org.bonitasoft.expenseclaimitem.ExpenseClaimItemType;
List cases = new ArrayList();
for(ExpenseClaimItemType expenseClaimItem in expenseClaimItems){
List caseRow = new ArrayList();
caseRow.add(expenseClaimItem.getPaymentDate().format(“dd MMM yyyy”));
caseRow.add(expenseClaimItem.getPaymentTo());
caseRow.add(expenseClaimItem.getPaymentAmount().toString());
caseRow.add(expenseClaimItem.getPaymentCateg());
caseRow.add(expenseClaimItem.getPaymentFile().toString());
cases.add(caseRow);
}
return cases;

Can’t figure out why this expression doesn’t run (Error while getting the form page list.):

2014-09-15 12:59:03 org.bonitasoft.forms.server.FormsServletExt
SEVERE: Error while getting the first page for id Expense Claim–1.3–Finance Approval$entry
org.bonitasoft.forms.server.exception.FormInitializationException: Error when evaluating expressions on activity instance 60094. Error on expression evaluation for the attribute [available-values] of object [expenseClaimTable].
at org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl.resolveExpressions(FormServiceProviderImpl.java:910)
at org.bonitasoft.forms.server.FormsServletExt.resolveFormFieldExpressions(FormsServletExt.java:401)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:354)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:323)
at org.bonitasoft.forms.server.FormsServletExt.getFormFirstPage(FormsServletExt.java:167)
at sun.reflect.GeneratedMethodAccessor164.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at org.bonitasoft.forms.server.FormsServlet.processCall(FormsServlet.java:138)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.sso.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.login.filter.NoCacheFilter.doFilter(NoCacheFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

Thanks.

Ola / Hi Ana,

Can you paste the whole stacktrace?

Cheers

Hi,
I’ve a variable firstName which type java.util.list
How can i display in table widget so the next data will be show in the next row?
Anyone?

Luqman,

This should be another diferent question.

Cheers

Hi,
The stacktrace is complete.
Cheers

Ana,

You should have more trace just before that with more explanation.

Can you check?

Thx

Ana,

I did a quick change to your code as I dont have your custom data type and it works…
It should be good to check if the objects are well populated or the return types are correct.

Anyway it should be good to see all logs

List cases = new ArrayList();
List expenseClaimItems = [[“getPaymentDate”:“getPaymentDate”,“getPaymentTo”:“getPaymentTo”
,“getPaymentAmount”:“getPaymentAmount”,“getPaymentCateg”:“getPaymentCateg”,“getPaymentFile”:“getPaymentFile”]]
for(Map expenseClaimItem in expenseClaimItems){
List caseRow = new ArrayList();
caseRow.add(expenseClaimItem.get(“getPaymentDate”));
caseRow.add(expenseClaimItem.get(“getPaymentTo”));
caseRow.add(expenseClaimItem.get(“getPaymentAmount”));
caseRow.add(expenseClaimItem.get(“getPaymentCateg”));
caseRow.add(expenseClaimItem.get(“.getPaymentFile”));
cases.add(caseRow);
}
return cases;

Sorry, I didn’t noticed that the engine log had more detail about this issue. Now I’m copying all the log:

2014-09-16 15:51:15 org.bonitasoft.forms.server.provider.impl.FormServiceProviderExtImpl
SEVERE: Username<thorsten.hartmann> Form<Expense Claim–1.3–Finance Approval$entry> Task
org.bonitasoft.console.common.server.utils.BPMExpressionEvaluationException: Error when evaluating expressions on activity instance 60259. Error on expression evaluation for the attribute [available-values] of object [expenseClaimTable].
at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnActivityInstance(ExpressionEvaluatorEngineClient.java:47)
at org.bonitasoft.forms.server.api.impl.FormExpressionsAPIExtImpl.evaluateActivityExpressions(FormExpressionsAPIExtImpl.java:383)
at org.bonitasoft.forms.server.api.impl.FormWorkflowAPIImpl.getActivityFieldsValues(FormWorkflowAPIImpl.java:769)
at org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl.resolveExpressions(FormServiceProviderImpl.java:854)
at org.bonitasoft.forms.server.FormsServletExt.resolveFormFieldExpressions(FormsServletExt.java:401)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:354)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:323)
at org.bonitasoft.forms.server.FormsServletExt.getFormFirstPage(FormsServletExt.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at org.bonitasoft.forms.server.FormsServlet.processCall(FormsServlet.java:138)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.sso.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.login.filter.NoCacheFilter.doFilter(NoCacheFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.expression.ExpressionEvaluationException: USERNAME=thorsten.hartmann | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Groovy script throws an exception of type class org.codehaus.groovy.runtime.typehandling.GroovyCastException with message = Cannot cast object ‘{paymentAmount=1.0, paymentDate=Mon Sep 01 00:00:00 BST 2014, paymentFile=paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02, paymentTo=1, paymentCateg=Airfare}’ with class ‘java.util.HashMap’ to class ‘org.bonitasoft.expenseclaimitem.ExpenseClaimItemType’ due to: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02’ with class ‘java.lang.String’ to class ‘long’
Expression : SExpressionImpl [name=expenseClaimTable:available-values, content=import org.bonitasoft.expenseclaimitem.ExpenseClaimItemType;

List cases = new ArrayList();

for(ExpenseClaimItemType expenseClaimItem : expenseClaimItems){

List caseRow = new ArrayList();

caseRow.add(expenseClaimItem.getPaymentDate().format("dd MMM yyyy"));

caseRow.add(expenseClaimItem.getPaymentTo());

caseRow.add(expenseClaimItem.getPaymentAmount().toString());

caseRow.add(expenseClaimItem.getPaymentCateg());

// caseRow.add(expenseClaimItem.getPaymentFile().toString());

cases.add(caseRow);

}

return cases;, returnType=java.util.List, dependencies=[SExpressionImpl [name=expenseClaimItems, content=expenseClaimItems, returnType=java.util.List, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_VARIABLE]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsOnActivityInstance(ProcessAPIImpl.java:5571)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)
at org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)
at com.bonitasoft.engine.transaction.JTATransactionServiceExt.executeInTransaction(JTATransactionServiceExt.java:55)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
at com.sun.proxy.$Proxy19.evaluateExpressionsOnActivityInstance(Unknown Source)
at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnActivityInstance(ExpressionEvaluatorEngineClient.java:45)
… 37 more
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Groovy script throws an exception of type class org.codehaus.groovy.runtime.typehandling.GroovyCastException with message = Cannot cast object ‘{paymentAmount=1.0, paymentDate=Mon Sep 01 00:00:00 BST 2014, paymentFile=paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02, paymentTo=1, paymentCateg=Airfare}’ with class ‘java.util.HashMap’ to class ‘org.bonitasoft.expenseclaimitem.ExpenseClaimItemType’ due to: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02’ with class ‘java.lang.String’ to class ‘long’
Expression : SExpressionImpl [name=expenseClaimTable:available-values, content=import org.bonitasoft.expenseclaimitem.ExpenseClaimItemType;

List cases = new ArrayList();

for(ExpenseClaimItemType expenseClaimItem : expenseClaimItems){

List caseRow = new ArrayList();

caseRow.add(expenseClaimItem.getPaymentDate().format("dd MMM yyyy"));

caseRow.add(expenseClaimItem.getPaymentTo());

caseRow.add(expenseClaimItem.getPaymentAmount().toString());

caseRow.add(expenseClaimItem.getPaymentCateg());

// caseRow.add(expenseClaimItem.getPaymentFile().toString());

cases.add(caseRow);

}

return cases;, returnType=java.util.List, dependencies=[SExpressionImpl [name=expenseClaimItems, content=expenseClaimItems, returnType=java.util.List, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_VARIABLE]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:146)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:77)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:180)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:102)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:76)
at org.bonitasoft.engine.api.impl.transaction.expression.EvaluateExpressionsInstanceLevel.execute(EvaluateExpressionsInstanceLevel.java:69)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsInstanceLevel(ProcessAPIImpl.java:5618)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsOnActivityInstance(ProcessAPIImpl.java:5568)
… 49 more
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘{paymentAmount=1.0, paymentDate=Mon Sep 01 00:00:00 BST 2014, paymentFile=paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02, paymentTo=1, paymentCateg=Airfare}’ with class ‘java.util.HashMap’ to class ‘org.bonitasoft.expenseclaimitem.ExpenseClaimItemType’ due to: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘paymentFile_0-e2e6ab87-1471-4cf6-bdf7-7608895d8a02’ with class ‘java.lang.String’ to class ‘long’
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:358)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at Script35.run(Script35.groovy:7)
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:127)
… 56 more

2014-09-16 15:51:15 org.bonitasoft.forms.server.FormsServletExt
SEVERE: Error while getting the first page for id Expense Claim–1.3–Finance Approval$entry
org.bonitasoft.forms.server.exception.FormInitializationException: Error when evaluating expressions on activity instance 60259. Error on expression evaluation for the attribute [available-values] of object [expenseClaimTable].
at org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl.resolveExpressions(FormServiceProviderImpl.java:910)
at org.bonitasoft.forms.server.FormsServletExt.resolveFormFieldExpressions(FormsServletExt.java:401)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:354)
at org.bonitasoft.forms.server.FormsServletExt.setFormFieldValues(FormsServletExt.java:323)
at org.bonitasoft.forms.server.FormsServletExt.getFormFirstPage(FormsServletExt.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at org.bonitasoft.forms.server.FormsServlet.processCall(FormsServlet.java:138)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.sso.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.bonitasoft.console.common.server.login.filter.NoCacheFilter.doFilter(NoCacheFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

What I can understand is that my script is not very happy with class attribute paymentFile. It’s a long type.

Has I didn’t understand why I was facing this issue, I changed my data type, so now the problematic attribute is String type. After that, I’m abble to display the table widget with the associated data.
Now, my issue is another one:
This problematic attribute is loaded by a file widget, and it’s working ok (I have another task, after loading this field, inside a repeting group, where I display it in a read only file widget - I can open the file I’ve previously loaded).
Now, when I display this information in a table widget, it display’s as a String field (“paymentFile_0-ca4d1779-e97a-4918-adb7-397adef5ec6e”), but I want to have the same user experience as in a file widget. Is that possible??

Ana,

if I understood well, you want to show a link to a file?
In that case you should generate as html (note you can enable it on Table Widget->Data->Allow html)
TIP: the download link goes thr a servlet with some parameters…

Cheers

Hi,
Well, in that case it’s more difficult for me… I’m not very fluent doing that.
Thanks for your answers and support.