Answered

How to calculate total price in 'My Second Process'

I have completed my second process workshop, I noticed that on the 'Process Invoice' Step (the last step)

It asks you to enter quantity, unit price and total price. What I thought would be useful is to enter the unit price and quanity and have it calculate the total price for you. Sounds simple ? Well for the life of me I can't figure out what I thought would be a simple task ! I have tried Business rules (Activity Actions) expressions in the form designer....nothing but errors !

Can somebody just walk me through how to do this ? its driving me crazy.

Thanks in hope.

Best Answer
photo

Dear Guy,

Notice you may use "grid totalizers" to view aggregated information from your collection (sums, averages, etc).

If you still wish to store the total into the "Invoice Total" attribute, you will require to include a button in that form that executes a Bizagi expression. In this expression, you would calculate and assign this value to the attribute.

For this calculation you will need to use the "Iterate through Xpath" module, so that you cover each of your rows for that collection.

Best regards,

Comments (16)

photo
0

Dear Guy,

If you wish to include an expression to calculate the total price based on the quantity and unit price, the recommended procedure would be to:

1. Include a button in your "Add_ProductRequest" form (this means in the form where you add new items in your collection of products requested).

2. Associate an expression to this button so that you execute:

<TotalPrice> = <Quantity> * <UnitPrice>;

In order to guide you best when you encounter difficulties, it is useful if you can provide us with further information, as to specify exactly any error message you are getting or perhaps attach screenshots of the issue.

Best regards,

photo
0

Hi, thank you for your reply. That did work a treat.

However I still have a query.

It will now (on click on the button) calculate the total price of each product line within the Product Request Collection.

But when on the last screen Process Invoice it does not give a Invoice Total, it has to be manually entered.

How can I store the grand total of all products ordered in the Invoice total field (held within the officesupplyrequest entity) can you help ?

photo
0

Dear Guy,

Notice you may use "grid totalizers" to view aggregated information from your collection (sums, averages, etc).

If you still wish to store the total into the "Invoice Total" attribute, you will require to include a button in that form that executes a Bizagi expression. In this expression, you would calculate and assign this value to the attribute.

For this calculation you will need to use the "Iterate through Xpath" module, so that you cover each of your rows for that collection.

Best regards,

photo
0

And what if you would just like to sum a colum of values and wish for that sum to be stored in an attribute on the form? I have tried to use the syntax in the 2013 manual and the button I created executes, however the calculated value is nowhere to be seen? Why cant the developers build into the suite simple arithmatic functions instead of users having to go out and reinvent the wheel in code to calulate a simple sum? Bizagi is extremely easy to use in some areas and unecessarily difficult in others!

photo
1

Saddened to see that three years later, no change on this.

If an Action is spawning in a grid, focus & context is that grid only - you don't have access to entities that are "higher-up" - not even the Process Entity.

Either Bizagi gives us "Global Vars" that can be modified *anywhere* and used *anywhere* - by FAR the easiest way to give us the extra functionality, or, when an Action is occuring at the grid level, open up in the XPATH tree access above it for doing Me.GetXPath() or Me.SetXPath().

These brick walls are a major pain.

photo
2

Dear Users,

Right now, we have a new feature called Actions and Validations which can see items out of the table.

To solve what you require, you need to create two actions: One to calculate the value of each product and another to calculate the value of purchase total

We have attached screenshots of how they should be done. The first one has a table context and the second one has form context (it is the context by default).

For further information please refer to:

Regards

photo
1

Could please include a screen shot op the rule Total Item Price?

Thanks a lot!

photo
1

Dear Justin,

Please refer to the attachments of the previous posted comment.

Look forward to hearing from you

photo
1

Sorry, I cannot find a screen shot of the Rule. Must have been something like this in the Expression manager:

<Salesprice> = <SoldQuantity> * <Product.SalesPrice>;

That works!

photo
1

Just one final remark for fellow Bizagi user that are like me relatively new to Bizagi. Be alert on the spaces when you edit an expression in the Expression manager.

Does not work:

<Salesprice>=<SoldQuantity>*<Product.SalesPrice>;

Does work:

<Salesprice> = <SoldQuantity> * <Product.SalesPrice>;

photo
1

Excuse me, that was not the cause. What made is work was the "refresh" action.

photo
1

and

<SimpleSO.SalesOrder.TotalSalesOrderValue> = <sum(SimpleSO.SalesOrder.Solditems.Salesprice)>;

photo
1

Excellent job! Well Done!!

Regards

photo
photo
1

Juan,

1) Which Bizagi version? v11 or v10.7?

2) Please share a screenshot the actual expression, and the Data Model popup of that expression.

I'm sure we'd all like to see how we can do this now.

Currently not possible to do in versions 10.7.0.2082 or 10.7.0.2287.

photo
1

Dear Mark,

Actions and validations is a feature from 10 version. Both v10 and v11 are allowed to be implemented in their projects. Please check the attached images in previous posted message.

Regards

photo
1

Juan, I agree that v10 has Actions & Validations - that is not the point I was making.

In order to understand the workaround I was asking for the actual code of the two expressions, "Total item price" and "Total Cost Estimate".

I currently need to do this for a project that is v10.7.0.2287, however had to put a button to do it. My customer is not happy with this.

IOW you tease us with a solution but only show half of the completed puzzle.