Forum Discussion

AdamWaring's avatar
AdamWaring
Qrew Member
2 years ago

'*' operator refuses to multiply numbers

I'm new to Quickbase so sorry if this has an obvious answer. I'm automating a shipping request email, and I've run into a head-scratcher. I'm calling a numeric field 'Shipping weight' from the 'Products' table with this:

GetFieldValues(GetRecords("{8.EX.'"&[Quote/Order Part #]&"'}", [_DBID_Products]), 22)

But when I try and multiply that with the numeric field 'Qty Quote/Order', it refuses to compile with the error "the operator '*' can't be applied on types textlist, number". It's eyebrow raising that you can't multiply a number LOL. I've tried wrapping the call in 'ToNumber' but it did not like that either. The full expression is:

If ([Qty Quote/Order] > 1, GetFieldValues(GetRecords("{8.EX.'"&[Quote/Order Part #]&"'}", [_DBID_Products]), 22) * [Qty Quote/Order], GetFieldValues(GetRecords("{8.EX.'"&[Quote/Order Part #]&"'}", [_DBID_Products]), 22))

What am I missing? Thanks in advance for helping out a noob!



------------------------------
Adam Waring
------------------------------

3 Replies

  • I am not at my computer to test this properly now but if you're looking to add up values, then you need to use this syntax here.  

    SumValues(GetRecords("{8.EX.'"&[Quote/Order Part #]&"'}", [_DBID_Products]), 22)



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
  • The result of the formula query is actually a textlist, even if it's a textlist of numbers. This is because the formula query may be returning multiple values depending on the query and the table you're querying.

    If you're positive that the query result is ALWAYS one number, you can probably get away with ToNumber(ToText([result of formula query]))

    If it's possible that it might be returning two or more values, then you have to make some harder decisions, like grabbing only the first number to multiply -- something like this:

    ToNumber(Part([result of formula query], 1, ";"))

    Without knowing more about your app, I can't say what will work best for you, but hopefully this at least helps explain why you can't multiply the direct result of the query without first converting it to a number.


    (Made a few edits above...)


    ------------------------------
    gary
    ------------------------------

    • AdamWaring's avatar
      AdamWaring
      Qrew Member

      Thank you both for the replies!

      I realized after I posted this that it's returning a list DERP. It's always one number, so Gary's wrappers did the trick. I had tried ToNumber() before, but I was missing the double wrapper with ToText(). This is what worked: 

      ToNumber(ToText(GetFieldValues(GetRecords("{8.EX.'"&[Quote/Order Part #]&"'}", [_DBID_Products]), 22))) * [Qty Quote/Order]

      Thanks again!



      ------------------------------
      Adam Waring
      ------------------------------