Seems like a simple answer, why can't i figure it out! :)

So, I saved some data as “text” and they should really be saved as “numbers.” Any way to convert the text to number while saving it into a new field? Here is my workflow where I get stuck. Im not really familiar with regex or if that is what i need to do. Thanks in advance for your help.

One hack that may work is loading the text to an input field that’s set to be a numeric value. Then, grab the number from the input field.

This has worked for me in the past so worth trying. Of course, you could make the input field a 1x1 pixel field so that it’s not seen be the end user.

Ok, let me see, maybe I can save it as a temp field with a save state and do the same thing. Thanks for the idea. Let me see if something like that works. I was hoping a regex would do it easier.

Ok, the save state didn’t work. i will try what you said, but I’m not sure how to do that from a workflow. Hmmm. let me see

I think i have too many numbers to convert. Do you know anything about regex or how to use it? So far my attempts have failed in using regex.

Nope, not really.

You could also download the data, convert it to numbers in excel, and then upload the data back to your Bubble DB. It might take a bit to get the upload working, but other than that this is quick.

Ya, that would make sense normally too but I don’t think that really works in my situation, kind of hard to explain. I think something like regex would be my only option. But it keeps telling me its a list of data.

Hi jklabbatz!

I’m curious, when you say “So, I saved some data as “text” and they should really be saved as numbers.”

What’s the process saving it as text? I’m sure you have a good reason for saving the data as text in the first instance but I am wondering why it couldn’t be saved as a Number. Maybe adding regex at that stage you could validate that it is indeed a number… if that makes sense.

I was saving the number as text by mistake last year when I was learning. But it’s already a text now and I need to convert it to numbers to have better functionality in my website.

:blush:

Ok, just to confirm…

So your custom state name is “tempOLDSchedule’s week1BEBibleReading” and it’s set up as a “text”
Looks like this?

image

To ask the obvious first… Why can’t you change the state type here from text to number? That will fix it right?
Will it break a ton of other stuff if you do change it to number?

I don’t “think” RegEx is the right tool to use because it’s more about pattern recognition and finding/validating characters within a string. Because that custom state is already in a text format you can’t really get around that, well not that I know of anyway! without doing something like @sridharan.s suggested with the Input box.

“tempOLDSchedule’s week1BEBibleReading” state may well contain only numbers and you “could” use RegEx to validate the data, but even after whatever validation you run, that custom state will still be seen as a text state and that’s where I think the problem lies.

Am I understanding what you’re trying to do correctly?

Well, “tempOLDSchedule” stores a “schedule” and in the schedule there is a “week1BEBibleReading” which is a text. So it’s not a save state really.

But basically I think you got it right. Ya. I guess there is really nothing I can do unfortunately.

So what I’m going do I think is something I did when I had saved some dates as type “text” and wanted to switch them to type “dates”.

Basically I still saved a field as “text” and then the next time the user clicks on it it will just start saving it as a “date”. So going forward it will be “dates”.

I’m going to do the same thing I think but with the numbers I have. A little bit more work but I think it will be ok. Just a little bit of “show” and “hide” if “this” and “that” kind of thing.

I guess regex is not the way to go. Thank you for explaining that to me. At least I know it’s not possible. Thank you. :slight_smile:

No probs, sounds like a sensible plan to me :grinning:

I think sometimes it’s better to do all the hard work making sure it’s setup right, after all you want whatever you create to run as efficiently as possible but good luck! Hope you get it sorted!

Paul