if() only results in the last option

Fiz um aplicativo de controle de vendas Appsheet, em que cada produto possui 3 preços possíveis diferentes, dependendo do cliente. 
Na tabela Carrinho de Compras, fiz uma coluna virtual chamada “PrecoUnitário” para calcular o preço do produto referenciado na tabela de produtos e depois adicionar em outra coluna de total.
Com apenas um valor está funcionando, agora quando coloco a fórmula IF ele considera apenas a última opção da fórmula:IF([Tabela] = "Tabela1", [Produto].[Preco1], IF([Tabela] = "Tabela2"
, [Produto].[Préco2],[Produto].[Préco3])).

 

0 5 139
5 REPLIES 5

Marc_Dillon_0-1693076928141.png

Please show examples of the data, the desired result, and the current actual result.

Hello! I have these 3 tables: One that lists products "Produto", one that registers orders, "Pedidos" and one that opens the shopping cart "Carrinho".

btelles_0-1693273229105.png

btelles_1-1693273292101.pngbtelles_2-1693273342840.png

In the reorder view, the user needs to choose 1 out of 3 possible price lists from the product table.

btelles_3-1693273889486.pngbtelles_4-1693273924524.png

my problem is when the user chooses one of the price reference tables, because the formula I use is not correct.

btelles_5-1693274314598.pngbtelles_6-1693274345903.png

THANKS FOR HELPING ME

I do not see any issue with formula. What exactly is the issue that you are seeing? The setup mostly looks fine as well, only thing I can comment on is why is the PrecoUnitario column a virtual column? It can just as easily be a real column, or just skip it all together and add it's formula into the formula for the Total column.

 

The PrecoUnitario column is virtual because it is composed of a combination of values ​​from two other columns. I thought it was mandatory to be virtual in these cases.

O problema que tenho é que o valor do preço não muda de acordo com a tabela de preços escolhida..., resta apenas a última opção. De qualquer forma, farei as alterações que você sugeriu e darei feedback. Obrigado!


@btelles wrote:

The PrecoUnitario column is virtual because it is composed of a combination of values ​​from two other columns. I thought it was mandatory to be virtual in these cases.


Nope.


@btelles wrote:

The problem I have is that the price value does not change according to the chosen price list..., only the last option remains.


Yes, you already said this. I'm looking for additional details.