It looks like there's a lot going on in the snippet, so it's a little hard to see what could be causing the issue. Could you share the snippet here (click the gear icon) or share it with me at dylan@blaze.today so I can take a look?
Unit Mix: Rent: Expiration: {repeat: 4; locals=properties}{formmenu: 1-Bed 1-Bath; default=2-Bed 1-Bath; 3-Bed 1-Bath; name=tableunitmix} {note}{formmenu: default=Occupied; Vacant; name=multifamoccupancy}{endnote}{if: multifamoccupancy="Occupied"}${formtext: cols=10; default={=replace(catch({site: text; page=https://now.mlsmatrix.com/*; select=ifneeded; selector=.multiLineDisplay .multiLineDisplay .multiLineDisplay .multiLineDisplay:nth-child(1) .d48m8 > .wrapped-field}, ""), "$", "")}; name=tablerentinfo}{else}{tablerentinfo="Vacant"}Vacant{endif} {if: multifamoccupancy="Vacant"}{tablerentexpiration="N/A"}N/A{endif}{note}{if: multifamoccupancy="Occupied"}{formmenu: default=Custom; Month-to-Month; name=tablerent; cols=10}{endif}{endnote}{if: tablerent="Custom"}{formtext: cols=10; name=tablerentexpiration}{endif}{if: tablerent="Month-to-Month"}{tablerentexpiration="M2M"}Month-to-Month{endif}{endrepeat} {endif: trim=yes}{if: multifamoccupancy="Occupied"}***Please note: Current rents should not be used for future projections, with most properties, you would either attempt to raise the rent with the current tenant(s) or find new tenant(s) at market rate rents.{endif}
To add the snippet here in the community, you have to replace 'snippet contents' with your snippet by copying the commands in the snippet and pasting it where 'snippet contents' is in the text here.
I think the issue could be that the form field 'multifamoccupancy' is within the repeat command, and the if statement is outside of it.
Could you potentially move the form field + note command it is inside of to outside of the repeat command? Please let me know if that works.
Once you paste the contents of your snippet where it says 'snippet contents', you should see a preview of the snippet on the right side of the page where you preview your post.
If moving the form field doesn't work, please let me know and we can find another solution.
Thanks Dan- I have tried all variations of the following snippet, and I can't seem to get it to work.
Currently I am getting the error: Unknown name "Locals"
Do you happen to have any other idea on how to structure this?
Just fyi- the name of my repeat function is "properties". The name of the variable I am trying to create an if/else command with is "multifamoccupancy"
Hi! I took a look at your snippet, and tried a different approach.
{note}Amount of units: {formmenu: default=1; 2; 3; 4; 5; name=unitamount}{endnote}
Unit mix Rent Expiration {repeat: unitamount ; locals=properties}{formmenu: default=3-Bed 1-Bath; 4-Bed 1-Bath; 5-Bed 1-Bath; 3-Bed 2-Bath; 4-Bed 2-Bath; name=tableunitmix} {note}{formmenu: default=Occupied; Vacant; name=multifamoccupancy}{endnote}{if: multifamoccupancy="Occupied"}${formtext: cols=10; default={=replace(catch({site: text; page=https://now.mlsmatrix.com/*; select=ifneeded; selector=.multiLineDisplay .multiLineDisplay .multiLineDisplay .multiLineDisplay:nth-child(1) .d48m8 > .wrapped-field}, ""), "$", "")}; name=tablerentinfo}{else}Vacant{endif} {if: multifamoccupancy="Vacant"}N/A{endif}{if: multifamoccupancy="Occupied"}{note}{formmenu: default=Custom; Month-to-Month; name=tablerent; cols=10}{endnote}{if: tablerent="Custom"}{formdate: YYYY-MM-DD}{endif}{if: tablerent="Month-to-Month"}Month-to-Month{endif}{endif}{endrepeat}
{if: contains(properties, "\"multifamoccupancy\": \"Occupied\"")}***Please note: Current rents should not be used for future projections, with most properties, you would either attempt to raise the rent with the current tenant(s) or find new tenant(s) at market rate rents.{endif}
Hi Ben! Thank you so much for crafting a few different variants, your second snippet introduced me to "buttons" I didn't realize those existed within Textblaze.
In this case I am actually looking to get a better idea of how to "phrase/format" the "locals" setting that Dan mentioned earlier. In order to reference a variable within a repeat function.
How would I go about creating an if/else for a variable within a repeat function? Thank you
Hey Andrew! When you request the condition multifamoccupancy="Occupied" - do you mean to request it for each row of the table separately, or do you want to request that it be true for any row in the table?
Hi Guarang! Thanks for the speedy reply, I am hoping to have this text pop-up whenever, any row of the (repeat) table is marked as Occupied:
***Please note: Current rents should not be used for future projections, with most properties, you would either attempt to raise the rent with the current tenant(s) or find new tenant(s) at market rate rents.
{if: count(filter(locals, x -> x.multifamoccupancy="Occupied"))>0}
Your text goes here
{endif}
Note that locals is a list containing one item for each of your rows. So if you have two rows, the locals list will look like this: [ { multifamoccupancy: "Value from row 1" }, { multifamoccupancy: "Value from row 2" }, ]. In my condition above, I filtered for rows that are occupied, and then made sure their count is more than zero.
Referencing the if/else you created (pasted below). If that text shows up, (the property is occupied at all). How would I send that info to Datablaze.
So for example: If the text shows up, because the property is occupied, how would I structure that / create a variable to be able to send a "yes" / "no" to a column named "occupied" in Datablaze?
Your previously created if/else:
{if: count(filter(locals, x -> x.multifamoccupancy="Occupied"))>0}
Your text goes here
{endif}
{occupied=count(filter(locals, x -> x.multifamoccupancy="Occupied")) > 0}
{if: occupied}
Your text goes here
{endif}
What I did here is to "lift" the condition (... > 0) into a separate variable assignment first (occupied = ), and then used that variable directly in my if condition (if: occupied) in place of the condition. You can now send this variable to Data Blaze as needed.