The address field auto-populates the full state name.
Sometimes, a user will enter the address fields manually. When they do, they frequently use the 2 letter state code.
I really need the full state name all the time, but can’t figure out a way to require it.
I have thousands of existing records, so I can’t really move away from the address field type.
You can use a datatable containing state names and abbreviations + a pipe to get the value you’re looking for.
I have something similar setup for an app but not exactly what you’re looking for, so you’ll have to read through the lines a bit here.
Here’s a CSV with State names and abbreviations you can use…
Here’s the basis of the pipe to use. You’re basically taking the inputted state value from the address field, and using that to search through the state datatable to find a match, and then returning the full state name in the response.
In my example here, I’m searching field_48 which is the full state name. You would want to search whatever field contains the abbreviations, make sure to change that in the API call.
Then using table rules, set the address field (state) to the correct pipe response.
Sorry that’s a very rushed response, but hopefully you get the idea. Happy to elaborate if you need it.
I have limited experience with pipes, but I think I get it. Thanks Tim!
Hey Tim. I’d like to do the exact opposite of this. I’d like to force state to always be 2 letters no matter what the user enters.
Can you walk me through a pipe usage for this?
I am thinking of using a pipe on the data table to run a lookup based on state value and then update the address state with the two letter code upon a record creation.
You can actually use a much simpler pipe to achieve this. Since you want to force users to enter the State a certain way, what you really want to do is check character length of the State name and show an error if it’s more than 2.
First, add the Tadabase Text Utilities Pipe
Next, navigate to the Form where a user is entering an address
We're going to add the Pipe inside a Validation Rule and check how many characters the Address->State field is and show a message if it's greater than 2 characters.
Select the Text Utilities Pipe, and select Get Length as the method.
Set the TEXT parameter to a record value of Address->State
Then set the validation to Pipe Response->Total Characters / is higher than / Custom / 2
Thanks! That would work if the user is entering it. But in this case it is google that is auto populating the field with the full address. So i think the complicated pipe would have to do.
Doesn’t seem like i can get this working though.
The Pipe is configured and returns the correct result:
But the records are not updating correctly? (I did add a new record through the front end of the app)
It looks like the pipe is not sending Address->State as a parameter. I will look into this a bit further.
Also, the response should be items.0.field_XX
I was able to get this working by pulling the state value into an equation and then using that equation field as the parameters for the pipe.