SUM the values within an ARRAY

Discuss here how to configure hoteldruid and better use its features.

Moderator: marco

Post Reply
Posts: 1
Joined: Wed Jun 26, 2019 7:12 pm

SUM the values within an ARRAY

Post by dnaisbi »

The subject really says it all, I need to learn how to sum the values in an array. For example the Array
will list the price of each reservation, but I need to know how to add them together.

The info here has been very helpful, but adding information on how to do equations within Arrays would be great:

I will be purchasing the hosting for multiple motels if I can get everything running well, I just want to make sure it will work well before the purchase.

It would also be VERY helpful if there was a place where everyone could post documents that they have made so others could use them if needed and everyone could also look at the documents to see how the different formulas were created.

Posts: 1298
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: SUM the values within an ARRAY

Post by marco »

I don't think you need an array to sum values of all reservations, just create a custom variable and add a condition to put it = 0 at the beginning of each reservations repetition and another condition to put it equal the sum of itself and the value you want to calculate. After the first repetition of reservations (you can also put [r][null_value][/r] at the beginning of the document) the variable will have the sum of all reservations.

Arrays are for special cases, for example when you want a repetition that doesn't match the reservations, like a repetition of days or % of taxes.

Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:

Post Reply