How to maintain all varible in loop?


#1

Hello every body,
I design a ticketing system as follow:
ticketing-system.bpmn (14.8 KB)

As you can see, There is loop in my design.
1- an expert confirm and response the ticket
2- if the customer’s problem not solve again an expert response him

The question is that how can i save all variable and history. I mean all the answers of the expert and all replies from customer.

Thanks every body in advance.


#2

Hi @mahdi,

if you set the history level to full then you can retrieve all variable data from the history.
However, it’s maybe not the best approach to use process variables for this data. Instead, you could use an external storage (i.e. other database or tables).

Best regards,
Philipp


#3

Hi, Thanks for ure response @Philipp_Ossler
Is it possible to use new variable each time? like sth that happen in generic form that we can define new variable.
And an other question is that how can i set my history level to full? Is it in BPMN model? or somewhere else?

Thanks,


#4

@mahdi you could create a class that has the relevant data as fields, e.g.

public class myinformation{
  String answer1;
  Integer amount;
} 

this data is filled with the informationen from the process. Then you create an

 ArrayList<myinformation> alldata = new ArrayList<myinformation>();

where the information of each iteration is appended. You can then store the alldata object in a process variable and will have all the data of each iteration in a list

execution.setVariable("alldata", alldata);

However, it might be better to save this data to an external system.

P.S. Code is untested


#5

Thank you very much @Tristan1
I think I get it.
I use php sdk API, I try to implement ure solution there.
thanks. If i succeeded, i will share my code.


#6

@mahdi here is an example using a json variable that is updated as the DMN loops:


#7

thank you very much @StephenOTT