Discussions

 View Only
  • 1.  Type mismatch

    Posted 5 days ago
    This is to calculate a bonus for our technicians based on how many hours they bill. Some technicians get an additional bonus for hours worked on refrigeration equipment and some don't. 
    I'm getting a type mismatch from my IF statement, so I added a tonumber but am still getting the same error. Any ideas?
    I've tested the parts of my formula separately and they work as far as I can tell, it's just the IF statement that's giving me grief.

    SumValues(GetRecords($myquery,[_DBID_QSALESHISTORY]),23)+[Hours Adjustment]+
    If([Refrigeration Rate]="",
    (tonumber(SumValues(GetRecords($aquery,[_DBID_QSALESHISTORY]),23)+[Refrigeration Hours Adjustment])))

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


  • 2.  RE: Type mismatch

    Posted 5 days ago
    can you post your whole formula?

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



  • 3.  RE: Type mismatch

    Posted 5 days ago
    Do I need to change the variable to a number?

    //Labor Codes FID 14 = technician, FID 17 = hours per tech
    //Query FID 42= technician, FID 12 = quantity, FID 16 = Month, FID 9 = item
    //_DBID_QSALESHISTORY, FID 22 = technician, FID 20 = GL date, FID 23 = actual quantity, FID 16 = category, FID 15 = description FID 25 = labor category

    var text myquery= "{20.GTE.'"&[First of Month]&"'} AND {20.LTE.'"&[Last of Month]&"'} AND {22.CT.'"&[User to text]&"'} AND {25.EX.'Regular'}";
    var text aquery= "{20.GTE.'"&[First of Month]&"'} AND {20.LTE.'"&[Last of Month]&"'} AND {22.CT.'"&[User to text]&"'} AND {25.EX.'Refrigeration'}";

    SumValues(GetRecords($myquery,[_DBID_QSALESHISTORY]),23)+[Hours Adjustment]+
    //If(([Refrigeration Rate])<1,
    (SumValues(GetRecords($aquery,[_DBID_QSALESHISTORY]),23)+[Refrigeration Hours Adjustment])

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