Help with a Formula in a list view
Hello!
Could you guys help me with a formula?
I have 3 tables:
appointments, treatments, products.
Each related to another:
each appointment can have several treatments,
each treatment can have several products that are used in that treatment.
In a list view of Appointments table i made a formula column, that calculates the comission of my employee. It checks the product type, and depending on it makes a calculation:
if Treatment.Product.Type = 5 then
Paid * 0.25
else
Paid * 0.15
end
The formula works fine when there is only one treatment in an appointment, but if there are 2 treatments or more, it ignores the "if Treatment.Product.Type = 5" and uses the option "Paid * 0.15".
Even if both threatments have Treatment.Product.Type 5.
I guess it has to use a loop or something to go through each treatment to calculate the comission for each and then give a sum. But i dont know how to acomplish it.
Help me please! )
1 reply
-
Try:
if contains(numbers(Treatment.Product.Type),5) then Paid * 0.25 else Paid * 0.15 endYou are correct, the moment you have 2 or more treatments then Ninox will return an array. To make things clear, we start with the numbers() command to tell Ninox to return the choice number of the Type field. Then we use the contains() command to compare the number 5 to the array and if it exists then.
Content aside
- 6 hrs agoLast active
- 1Replies
- 15Views
-
2
Following
