Adding Together A List From A Repeat Function

Hi Team,

I am creating a new snippet with the purpose of evaluating larger properties/portfolios

For this reason I am wanting to create a way to quickly compile the list of different unit types -- for example- there may be 4, 3-bedroom units and 6, 2-bedroom units

I am then, of course, wanting to add all of these rents together to compile the total expectable rent, I am just not very familiar with how to properly handle (add/multiply) lists generated with the repeat function

1 Like

Hello,

You can use the list functions to work with lists, here are some examples below based on what you said you need:

{bedrooms3=[100, 200, 300]} {bedrooms4=[50, 150, 250, 350, 450]}{allbedrooms=merge(bedrooms3,bedrooms4)}
All bedrooms: {=allbedrooms}
Total price: {=sum(allbedrooms); format=$,.2f}

Bedrooms 3 but each value is multiplied by 3:
{=map(bedrooms3, (x) -> x*2)}

If you can share some specific code, I may be able to help you further!