best grammar app

How to manage variable/multiple number of Datafields in Savvion

Submitted by Abhishek on Thu, 2011-12-08 17:58
Sencha.com

 

Savvion Business Manager allows you to work with defined number of Dataslots. You would use BPM Studio to define these dataslots during design time and use then in your process during run time. However, there are scenarios where you may not know how many datafields are required during design time. Some Examples are

  • You are creating an invoice and you would need to have a variable number of line items for the invoice

  • You are opening an account for a Client Entity and would like to add number of account operators

  • You are doing a trade reconciliation workflow and want to add N number of trades that need to be reconciled

For such scenarios you do not know how many fields need to be made available during runtime and so cannot define dataslots for them during design.

How do you handle such situation? Here is how. We will take the invoice use case to come up with a strategy.

Lets assume you have the following fields in the variable portion of the form

  • Line Item Number

  • Particulars

  • Rate

  • Quantity

  • Total

 

Savvion provides something called Business Objects to handle such scenarios. However, using Business Objects happens to be tricky and lot of coding is required. We will use an XML based approach to achieve this.

 

Step 1: Define an XML Dataslot

You would need to define an XML dataslot called invoiceDetails. You can do this very easily from the dataslot properties tab in your BPM Studio. We will use this dataslot to store the invoice details. We could have defined it as a String dataslot as well but the problem with String dataslots is that they have a size limitation depending on your database. For example if you are using sybase it would need to be max 200 characters. If you feel that you will need just a few line items and this space would be sufficient to store the XML feel free to use String dataslot instead.

Step 2: Define fields on the form

For defining the fields on the form you would need to make use of some clever javscript. You can also make use of Rich text frameworks like Ext JS to create a grid.

If using basic HTML and javascript define an HTML Table that looks like this

 

Line Item

Particulars

Rate

Quantity

Total

(checkbox)

(textfield)

(textfield)

(textfield)

(textfield)

(textfield)

Under it add two buttons

  • Add Row: This button will call a javascript which will have code to add another row under the first row. If you are using jquery this could be achieved with far less code.

  • Remove Row: This button will call a javascript function which will identify a selected line (checkbox) and then remove it. You can use some index numbers to denote each row

Each of the cell will have a textfield. While duplicating if you use the same names for your fields in each row, you will get the data as an Array. For example if you named the textfield for particulars as “particulars” then you will be able to access it as document. Forms[0].elements[“particulars”][0].value later.


Abhishek Mishra
Good experience in working with BPM technologies like Savvion, JBPM. Founder and Chief Editor of BPMGeek.com. Founder of Savvion Business Manager Mobility Framework Savmobify| View my BPMGeek Profile
|
best grammar app

About BPMGeek

BPMGeek is an initiative to collaborate and communicate with the growing Business process management community out there. The goal is to help developers connect with experts, ask questions, post their learning and get understanding of BPM Concepts. Often tool specific knowledge of niche areas end up developers perplexed and confused - especially when there are very less number of resources available. We will be coming up several several new features. Have a look at our Roadmap here

BPMGeek is an independent entity not associated with any Product. All BPM product professionals are invited to contribute. The Logos and Names used across the site belong to their respective owners. The viewpoints mentioned by Individual contributors are their own. BPMgeek cannot be held liable for any issues arising out of it.


BPMgeek is promoting the Nounshoun English Grammar App - developed by Constellation Software.