Forum Discussion

AnneMartin's avatar
AnneMartin
Qrew Trainee
3 years ago

Formula Query expecting number but found text

I'm new to writing formula queries and keep running into type mismatches. 
I'm figuring bonuses for our technicians, and have the bonus rate stored on another table.

var text myquery= "{8.EX.'"&[User to text]&"'}";
Getfieldvalues(getrecord($myquery,[_DBID_TECH_Info]),7)

The formula above says it's expecting a number but found text. Do I need a different function to look up a text field?

------------------------------
Anne Martin
------------------------------
  • Ya, we are all new to Formula Queries.  I still get a thrill every time they work first crack.

    Assuming that you know that you will just get one "hit",

    try this
    var text myquery= "{8.EX.'"&[User to text]&"'}";

    ToNumber(
    ToText(
    Getfieldvalues(getrecord($myquery,[_DBID_TECH_Info]),7) ))

    // the Totext converts the result from a "textlist" format to regular text and of courser the ToNumber converts it to a number
    //  just yesterday I was not pleased to find that when the numeric currency Rate field that I was trying to grab was formatted with a leading $ that converting it to a number failed.  Seems very unfair that the formula query it's sensitive to the formatting of the field. Certainly Excel does not behave that way. But that is just my little rant for the day.  I'm balance formula queries are wonderful. 

    If that also happens to you  you will need to do this.

    ToNumber(
    NotLeft(
    ToText(
    Getfieldvalues(getrecord($myquery,[_DBID_TECH_Info]),7) ),1)

    Hopefully my brackets are correct.


    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • AnneMartin's avatar
      AnneMartin
      Qrew Trainee
      I tried this but unfortunately it still does not work. The variable seems to be the problem, as $myquery is highlighted in the formula.

      ------------------------------
      Anne Martin
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        Please post a copy and paste your formula text and also the error message

        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------