@potentialthings, do you know if this should work with state values of type text as well? The usual dynamic data menu appears, but I can’t seem to enter any string constants.
Ooo, I’ve never tried it with state values. Good question.
No it doesn’t work with states.
YES! I go it. Follow this simple 12 step process. LOL
I wanted to share this since I had to go through “H E double hockey sticks” to get there. (To the Bubble team, please make this easier and you will reap the benefits!)
In my case I wanted to concatenate only two components of full address field into a custom state. Do this.
- Create an input field (that you will later delete only used for this operation)
- In this input field make sure the CONTENT FORMAT is set to TEXT
- Enter in the INITIAL CONTENT box your first part followed by spacebar then enter your second part spacebar so forth
- In my case it was something like AddressField Extract City (space) AddresField Extract County
- TRICKY PART: Now change the CONTENT FORMAT of this temporary input field to ADDRESS
- Right click in the INITIAL CONTENT and select COPY
- Go to your WORKFLOW and select SET STATE
- Create new CREATE NEW CUSTOM STATE eg. STATE NAME: MyConcatPartAddress
- Make it STATE TYPE: ADDRESS
- Right-click in the VALUE box and select PASTE
- Test your value of the state (eg. a text box) and you may now delete the input you created for this operation
Yep, this turned out to be pretty handy!
Nice work @mente12 - really appreciate the solution. But it’s absurd that we can’t do this in one natural step… instead of in 12 easy steps. Here I’ve been banging my head for an hour trying worthless workarounds until I came across this post. What’s the best way to get the bubble team to fix this?
There’s a method I’ve been using which is just one step. Basically, it relies on the ‘find-and-replace’ function. Simply set the first text value in the custom state then apply a find-and-replace to the text. In this case, the text that you find is the same one in the custom state. The replace function allows you to mix dynamic and static data so you can then replace it with whatever you want.
Or I’ve got another equally simple way that I use all over my app… make the value of the state “current date/time is not empty:formatted as text”. This will obviously always equate to “yes”, and in the “yes” box you get the full dynamic value editing area where you can concatenate to your heart’s desire…
(Credit to @keith for passing on the idea!)
Thanks for mentioning that, @antony — I was gonna post but couldn’t quickly find that reply to you where I explained that (you may wanna link to that if you’ve got it handy).
BTW, to others interested: While it’s sometimes frustrating, this behavior is not a bug. There’s an expression field for “any type of value” and there’s a text-specific expression field specifically for texts.
Internally, we can only display the text-specific field when we know the input value can ONLY be a text. (@antony, you might have run across this by now in your explorations on the plug-in editor… it’s the “Long Text” option in the field editor if I’m not mistaken.)
Hey Keith, it’s a pleasure… I’ve edited the post to credit you with the idea!
Perhaps you can elaborate with pictures? What type are you setting the state to?
This is a point of real frustration for me. All I want to do is display a marker on a google map and it seems like I have to concatenate values (namely street, city, state…) as the Marker Address. Despite about 30 variations I’ve tried for injecting an address into the Marker Address field for the map widget, I just can’t seem to get it to display the address. I’ve tried setting the value to a custom state (of type TEXT, Geographic Address, Text formatted as an address) but that doesn’t work. I’ve tried @mente12’s solution but that also didn’t work (resulted in very strange behaviors in the editor where my dynamic address would resolve to some random address… almost like geocoding was actively… well… geocoding). Below I even seem to have the right information for the current marker’s address but that doesn’t work either… what do I do?
Hey, @zelus_pudding… is your app on a yourappname.bubbleapps.io domain, or on your own custom domain?
If you’re on the latter, then there appears to be a bit of a complexity in getting the mappings stuff to work… see below for the (currently partial) details!
@zelus_pudding, unless I’m misunderstanding, you might want to try a Search Box input element and set it to Geographic places. It might simplify things considerably if you’re trying to enable users to specify a location and then display it on a Gmap.
Excellent suggestion @antony - that’s really good to know about though it actually wasn’t an issue I had run into. I couldn’t implement @shot’s suggestion for various reasons but fortunately I figured out how to force GMaps to render my address stored as a state from a concatenation of strings. It’s so round about my head’s spinning:
create a custom state of type TEXT
Concatenate the strings of interest in the formatted text dialogue that the above step opens:
Create an invisible input who’s initial content is set to the custom state’s value and make sure to set it’s type to ADDRESS.
Finally, set the MARKER ADDRESS of the map element to the value of the invisible input element from step 4.
Thanks all for the help
Hey @zelus_pudding, that’s great you’ve been able to work through the solution. These challenges seem like such a mountain to climb at the time, and the relief it so great when you reach the summit!
You could avoid using an invisible input field by doing this: …
… You could use another Set State (Geographical Address) call it say “geo_address” and who’s value will come from State “kitchen_address_full” (text) value. Then assign the map marker to the Geographical Address state; “geo_address”.