Adding + Multiplying Items from a list

**I am not sure why the snippet is showing these errors when I insert it here- it does not give me these errors when I am editing (edit, it seems to be giving errors for case sensitive variables, which it does not show within the normal TB editor anbd functions fine otherwise)

I am creating a new snippet with the purpose of evaluating larger properties/portfolios. For example: A 12-unit building.

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

What would be the right formula to use in order to compile/add all the rents together multiplied by the amount of units of that type?

The one caveat is that sometimes there can be a portfolio with multifamily and single-family properties as well (which is why I added) the "multifamily / single family" dropdown.

I have been trying to figure this out but I'm still unsure how lists function and how to add things together from a list etc.

Thank you for your help on this!!

Water is metered separately / tenants pay: {formtoggle: name=water; default=no}{endformtoggle}
Taxes: ${formtext: name=taxes; cols=10; default={=replace(replace(catch({site: text; page=https://now.mlsmatrix.com/*; select=ifneeded; selector=.d118m10 > .formula}, ""), ",",""), "$","")}}(don't put commas){endnote}{note}
{{^^%F0%9F%93%8D^^}} Area:
{formtext: name=area_code; default=; cols=10}
This property is in the {=property class} class area of {=area name}{endnote}{note}
{dbselect: SELECT 3 Bed Single Fam, 4 Bed SIngle Family, 1 bed Unit, 2 Bed Unit, 3 bed Unit, Area Code:, Property Class, Area Name, Has POS? FROM Website WHERE Area Code: = @area_code; space=70aIJmMqGzInMjZGqRCcDJ; menu=no}

{{^^%F0%9F%92%B2^^}}Price: {formtext: name=calcprice; default={=replace(replace(catch({site: text; page=https://now.mlsmatrix.com/*; select=ifneeded; selector=.d111m11 :nth-child(2) > .d111m10 > :nth-child(1)}, ""), "$", ""), ",","")}} (do not put commas)

{{^^%E2%9C%85^^}} Potential Market Rate Rents: {note}ZIP code: {data=catch({site: text; page=https://now.mlsmatrix.com/*; select=ifneeded; selector=.d-mega}, "")} {zipfound=catch(extractregexall(data, "\d{5}")[-1], "")}{if: len(zipfound)>0}{zip_code=zipfound}{=zip_code}{else}{formtext: name=zip_code}{endif}{endnote} {note}

{{^^%F0%9F%8F%A0^^}} Property Type: {formmenu: default=; Single Family; Multifamily; name=propertytype}{endnote}{if: propertytype="Single Family"}
{dbselect: SELECT Section 8, Bedrooms, Rent FROM Section 8 WHERE ( Section 8 = @zip_code OR Section 8 = "Zip Does Not Show Up") AND Bedrooms=@numberofbedrooms ORDER BY Section 8, Bedrooms; space=70aIJmMqGzInMjZGqRCcDJ; menu=no}

{note}{{^^%F0%9F%9B%8F^^}} Bedrooms:{formmenu: default=3; 4; name=numberofbedrooms}{endnote}
Single Family:
~{totalrents=higherrents if Current Rent Higher Than Market?="Yes" else 3 bed single fam if numberofbedrooms=3 else 4 bed single family}{=totalrents}/m from a cash paying tenant
~{s8totalrents=rent}{=s8totalrents}/m through section 8
{else}
{note}Unit Mix (beds/baths): {formmenu: same; default=different\n; name=bedroomtype}
Different Types Of Units: {formtext: name=numberofunits}{endnote}
{if: bedroomtype="same"}{note}Number of Bedrooms/Unit: {formmenu: 1; default=2; 3; name=multifamilybedrooms}{endnote}
{dbselect: SELECT Section 8, Bedrooms, Multifam Rent FROM Section 8 WHERE ( Section 8 = @zip_code OR Section 8 = "Zip Does Not Show Up") AND Bedrooms=@multifamilybedrooms ORDER BY Section 8, Bedrooms; space=70aIJmMqGzInMjZGqRCcDJ; menu=no}
~{=Multifam Rent}/m/unit through Section 8
~{=higherrents/numberofunits if Current Rent Higher Than Market?="Yes" else 1 bed unit if multifamilybedrooms=1 else 2 bed unit if multifamilybedrooms=2 else 3 bed unit if multifamilybedrooms=3 else ""}/m/unit from a Cash Paying Tenant

{{^^%F0%9F%92%B5^^}}Potential Total Market Rate Rent:
~${s8totalrents=replace(replace(Multifam Rent, "$", ""), ",", "")* numberofunits}{=s8totalrents}/m through Section 8
~${amount=1 bed unit if multifamilybedrooms=1 else (2 bed unit if multifamilybedrooms=2 else 3 bed unit)}{totalrents=higherrents if Current Rent Higher Than Market?="Yes" else replace(replace(amount, "$", ""), ",", "") * numberofunits}{=totalrents}/m from a Cash Paying Tenant
{else}
{repeat: {=numberofunits}; locals=rents}
{if: singleormulti="Multifamily"}{dbselect: SELECT Section 8, Bedrooms, Multifam Rent FROM Section 8 WHERE (Section 8 = @zip_code OR Section 8 = "Zip Does Not Show Up") AND Bedrooms=@numbedrooms ORDER BY Section 8, Bedrooms; space=70aIJmMqGzInMjZGqRCcDJ; menu=yes}{endif}{if: singleormulti="Single Family"}{dbselect: SELECT Section 8, Bedrooms, Rent FROM Section 8 WHERE (Section 8 = @zip_code OR Section 8 = "Zip Does Not Show Up") AND Bedrooms=@numbedrooms ORDER BY Section 8, Bedrooms; space=70aIJmMqGzInMjZGqRCcDJ; menu=yes}{endif}{formmenu: default=Multifamily; Single Family; name=singleormulti}Number of: {formtext: name=amtofunits; cols=5}, {formtext: name=numbedrooms; cols=5} bedroom unit(s) =
{if: Current Rent Higher Than Market?="No"}~{if: singleormulti="Multifamily"}{=Multifam Rent}{endif}{if: singleormulti="Single Family"}{=rent}{endif}/m/unit through Section 8
~{=1 bed unit if numbedrooms=1 else 2 bed unit if numbedrooms=2 else 3 bed unit if numbedrooms=3 else ""}/m/unit from a Cash Paying Tenant{endif}{endrepeat}

{{^^%F0%9F%92%B5^^}}Potential Total Market Rate Rent:
~${s8totalrents=reduce(rents, 0, (v, x)->v+replace(replace(x.multifam rent, "$", ""), ",", ""))}{=s8totalrents}/m through Section 8
~${totalrents=higherrents if Current Rent Higher Than Market?="Yes" else reduce(rents, 0, (v, x)->v+replace(replace(replace(1 bed unit,"$","") if x.numbedrooms=1 else (2 bed unit if x.numbedrooms=2 else 3 bed unit), "$", ""), ",", ""))}{=totalrents}/m from a Cash Paying Tenant{endif}{endif}

{formtoggle: name=Current Rent Higher Than Market?; default=no}{endformtoggle}{if: Current Rent Higher Than Market?="Yes"}
Current Total Rents: ${formtext: cols=8; name=higherrents}(do not enter commas){endif}

Hi,

Some of the errors are because of the variable syntax. For example if you have a variable named property class, {=property class} needs to be written as {=property class} (this can also be done by clicking on the variable under forms in dynamic commands). Since this snippet, would you be available to schedule a quick call to walk through your thought process? If not, I can work on a solution and get back to you. Thanks!

Hi Alex --Okay copy that on the syntax- and yes I am free- want to meet on a Google meet? Thank you

Google meet works well, what is a good email to send the invite too? And what times work best today or tomorrow?