Discussions

 View Only
  • 1.  Formula Query expecting number but found text

    Posted 15 days ago
    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
    ------------------------------


  • 2.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    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
    ------------------------------



  • 3.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    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
    ------------------------------



  • 4.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    Please post a copy and paste your formula text and also the error message

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



  • 5.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    Is this what you're asking for?

    //Tech Codes FID 8 = technician, FID 17 = bonus rate

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

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



    ------------------------------
    Anne Martin
    ------------------------------



  • 6.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    Change GetRecord to GetRecords

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



  • 7.  RE: Formula Query expecting number but found text

    Posted 15 days ago
    Thanks, Blake & Mark. That worked!

    ------------------------------
    Anne Martin
    ------------------------------