Forum Discussion

MackenziePhilli's avatar
MackenziePhilli
Qrew Trainee
5 years ago

Limit Office Choice on Address

I have a project table that has a choice for office and the project address. Depending on the input of address I want it to display a message if the project office and the address do not align. I tried making a large if statement that if the address was one of the towns in boston, to show boston, and then I would make a form rule to display a message off of that. This doesnt seem to work. Is there a different way to utilize the address city field?

Code for if statement: 
If([Project Address: City]= "Allston","Boston",
If([Project Address: City]= "Back Bay","Boston",
If([Project Address: City]= "Bay Village","Boston",
If([Project Address: City]= "Beacon Hill","Boston",
If([Project Address: City]= "Brighton","Boston",
If([Project Address: City]= "Charlestown","Boston",
If([Project Address: City]= "Chinatown","Boston",
If([Project Address: City]= "Dorchester","Boston",
If([Project Address: City]= "Downtown","Boston",
If([Project Address: City]= "East Boston","Boston",
If([Project Address: City]= "Fenway","Boston",
If([Project Address: City]= "Harbor Islands","Boston",
If([Project Address: City]= "Hyde Park","Boston",
If([Project Address: City]= "Jamaica Plain","Boston",
If([Project Address: City]= "Leather District","Boston",
If([Project Address: City]= "Longwood Medical Area",
If([Project Address: City]= "Mattapan","Boston",
If([Project Address: City]= "Mission Hill","Boston",
If([Project Address: City]= "North End","Boston",
If([Project Address: City]= "Roslindale","Boston",
If([Project Address: City]= "Roxbury","Boston",
If([Project Address: City]= "South Boston","Boston",
If([Project Address: City]= "South Boston Waterfront","Boston",
If([Project Address: City]= "South End","Boston",
If([Project Address: City]= "West End","Boston",
If([Project Address: City]= "West Roxbury","Boston",
If([Project Address: City]= "Cambridge","Boston",
If([Project Address: City]= "Sommerville","Boston",
If([Project Address: City]= "Boston","Boston","N/A")))))))))))))))))))))))))))))

------------------------------
Mackenzie Phillips
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    If([Project Address: City]= "Longwood Medical Area",

    This line is missing the second part of the formula. So that would probably cause some unexpected behavior.

    Also you do not need to nest your ifs like that. You could remove every if you have except the first one and get rid of your long tail of parenthesis and it would work just the same. Quickbase will continue down the formula until it hits something that matches or show your else which would be N/A in your above formula.

    If(
    [My Field] = "Something", "Do This",
    [My Field] = "Something Else", "Do That",
    "Nothing matched!"
    )

    One thing you should make sure to do when testing a form rule is that once you type into the address box, the city part, make sure to click somewhere else in the form. Any other text box and then the form rule should fire. It doesn't consider the field changed until you click into another one, to give you time to type everything you need. Depending on how your form rule is set up it it may not fire at all.

    That said this may not be the best approach to doing this. Unless you don't think the formula will grow much larger than this. It would just be a nightmare to maintain I think.