Calculations
Hi Guys, New to Polio and trying to build a Products app. I have a extra requirement in that we have input pricing for the products that we sell in US$, GBP and EUR whilst we sell in South African Rands. I therefore need a way to calculate the current suggested retail price based on the exchange rate. I was thinking of using 2 apps with one being the Product App and the second a Exchange Rate App. The exchange rate app would simply have 4 fields: Date Zar_USD Zar_GBP Zar_EUR We can then update the correct exchange rates from time to time. In the Items App we will then have 4 price input fields rUSD, rGBP, rEUR and rZAR. I need a formula for a calculated field that would do an If Then Else type calculation. A) If rZar is supplied that would override anything in the other 3 and Zar Price = rZar B) If rZar is not supplied then if rUSD is supplied then Zar Price = rUSD x ZAR_USD and the same for rGBP and rEUR. C) We will only ever supply 1 of rUSD / rEUR / rGBP Sorry I am way to old to learn JSON now and hope you can help. Thanks Fritz

  • Hi Fritz, you need a relationship field in Products which links the exchange rate item.The calculation is simple - and not the issue: var usd = @sum of Zar_USD;var gbp = @sum of Zar_GBP;var eur = @sum of Zar_EUR;var rZar = @rZar;var rUSD = @rUSD;var rGBP = @rGBP;var rEUR = @rEUR;rZar ? rZar : rUSD ? rUSD * usd : rGBP ? rGBP * gbp : rEUR ? rEUR * eur : 0; The issue is: If you change the exchange rate the price of all former Products will also change cause they pull now the new vrte value in their calculation fields. Means: You have to create a new exchange rate item each time you enter new rates. I recommend to add a category field Status with 2 categories (active/inactive) to the Exchange Rate app. Each time you create a new item make it active and the former one inactive. Then create a view "Active Item" in the app which filters for Status = active (should be always only 1 item in that view). Then in the relationship field settings (in "choose an app") in Products remove the option "All items" by the view "Active Item". Make the relationship field "required" so that the user is forced to link the product item to the active exchange item. Rainerrg@delos-consulting.com
This question is closed.