Lookup Relationship and Filter/Compare, return result to Calc Field
So I have an app, that captures the order, "ORDER", I have a relationship to client, "CLIENT", i have a relationship to pricing tiers, "PRICING".  I want to be able to look up pricing based on tiers where my order quantity falls within that tier for that client.  What's the best approach to achieve this?   In "ORDER" I have a single relationship to  "CLIENT", In "CLIENT" I have a multiple relationship to "PRICING", where in "PRICING" I have "From QTY",  "To QTY" and "Price" i.e. for client Blue "From QTY" = 100   "To QTY" = 250   Price = $7 "From QTY" = 251  "To QTY" = 1000   Price = $5 for client Red "From QTY" = 100   "To QTY" = 750   Price = $7 "From QTY" = 751  "To QTY" = 2000   Price = $5   I want to be able to pull the price base on quantity in the order.  So if order has 600, the pricing would be $5 if client Blue is on order, but $7 if client Red.   Hope that made sense.  Thanks in advance.

  • Hi, a solution for Podio calculation field:In CLIENT add a calculation field, e.g. called "QPrice". Enter. var from = @all of From QTY;var to = @all of To QTY;var p = @all of Price;var qprice = [];for(var i  = 0; i < from.length; i++){qprice.push(from[i] + "|" + to[i] + p[i]));};qprice.join() I assume From QTY and To QTY a re number fields, Price is a number oder money field. The result for Client Blue is this string: 100|250|7,251|1000|5 . Make this field "always hidden".Then in Orders (I assume in Orders is a QTY field which is a number field) add a calc field "Total Price": var qty = @QTY;var qprice = @all of QPrice;var total = 0;for(var i = 0; i < qprice.length; i++){qpSplit = qprice[i].split("|);from = Number(qpSplit[0]) || 0;to = Number(qpSplit[1]) || 0;price = Number(qpSplit[2]) || 0;if(qty >= from && qty <= to)total = qty*price;}};total The disadvantage: When you change the Price, from or to the change will be modify all existing orders. Rainer
This question is closed.