I have a complex text formula field that extracts out text from another text field. If it contains a number, I want to use it in another formula field's calculations. If not, I want to skip over it and use a different text field's number. In MS Access there's a nice IsNumeric() function that will return true/false after testing a text string, but I see nothing of the sort in the function list for QuickBase. is there an easy, tricky way around this limitation?

- 2,216 Points

Posted 2 years ago

QuickBaseCoach App Dev./Training, Champion

- 62,478 Points

There may be other ways but this might be quick and dirty as a formula checkbox field. But this will fail if the number has a leading zero like 0123. If that is possible, then the formula will need to be a bit fancier.

ToText(ToNumber([maybe a number]))=[maybe a number]

ToText(ToNumber([maybe a number]))=[maybe a number]

- 2,216 Points

Thanks Mark. That's clever, but I couldn't get it to work. For my current purposes, this seems to have done the trick.

Length([Subject Form ID]) > 0 and Left([Subject Form ID],1) >= "1" and Left([Subject Form ID],1) <= "9"

It really bugs me, though, that there isn't a native function to do something so straightforward and necessary.

Length([Subject Form ID]) > 0 and Left([Subject Form ID],1) >= "1" and Left([Subject Form ID],1) <= "9"

It really bugs me, though, that there isn't a native function to do something so straightforward and necessary.

QuickBaseCoach App Dev./Training, Champion

- 62,478 Points

I did test that formula and it did seem to work for me ... did you have a string that failed that I could test it on. The useful idea is that the ToNumber( ) function will return blank it what you give it contains non numeric characters.

In my test, the field for [maybe a number] was a text string.

In my test, the field for [maybe a number] was a text string.

- 218 Points

That could be a problem. What if it was a blank? And the tonumeric also returns a blank. Then they both will be equal, thus misleading us to believe that a blank is numeric.

I guess, we need to first filter out blanks and call them non-numeric right away before checking for non-blanks.

if (Contains([may be a number]," ",false,ToText(ToNumber([maybe a number]))=[maybe a number])

I guess, we need to first filter out blanks and call them non-numeric right away before checking for non-blanks.

if (Contains([may be a number]," ",false,ToText(ToNumber([maybe a number]))=[maybe a number])

QuickBaseCoach App Dev./Training, Champion

- 62,478 Points

to test for a blank you would use

IF(Trim([my text field])="", true)

ie you test against empty quotes

IF(Trim([my text field])="", true)

ie you test against empty quotes

- 2,216 Points

Yeah, I would have though it would work for me,but it didn't. The particular piece of text that was a problem was 'Oneil (starting with an apostrophe). For my purposes, I am extracting FormID's which are all positive integers from 2 to 5 digits long, so I took the simple way to just test the first character, but I would like to get your more universal approach to work too, for what I'm sure will be later needs for this functionality.

QuickBaseCoach App Dev./Training, Champion

- 62,478 Points

I tried 'Oneil on my formula and it correctly said it was not a number

(Edited)

- 2,216 Points

Hmm. Thanks for letting me know. I'll have to go back and do some more testing when I have time. Too much else going on with this project right now - I need to keep moving. Thanks again for your help!

Ⲇanom the ultimate (Dan Diebolt), Champion

- 29,904 Points

I would avoid getting into a situation where you have either

You probably could do a simple formula knowing that a number in a business setting consists of a

QuickBase does not use scientific notation for numbers but technically you could have this in your string and

ToNumber("34e5") => 3400000

Or you could use JavaScript where any manner of parsing and data conversion is possible. Anyone here that could write a formula to accomplish the task you ask about could do it easier in JavaScript. Replace the formula language with JavaScript is my advice.

It strikes me as extremely odd that for a

**text**or a**numeric**value in a text field in the first place. Rethink your fields and calculations. Ambiguous data (text/numbers) should be cleaned up at the point of key entry or importing.You probably could do a simple formula knowing that a number in a business setting consists of a

**{set of digits}**possibly proceeded by a**plus or minus sign**and at most one**decimal point**amid the digits but it is just an exercise if difficulty.QuickBase does not use scientific notation for numbers but technically you could have this in your string and

**ToNumber ()**will convert it correctly.ToNumber("34e5") => 3400000

Or you could use JavaScript where any manner of parsing and data conversion is possible. Anyone here that could write a formula to accomplish the task you ask about could do it easier in JavaScript. Replace the formula language with JavaScript is my advice.

It strikes me as extremely odd that for a

**no code**platform the first thing you have to do is master the formula language and all its quirks.**̄\_(ツ)_/ ̄**