Hello,
I have two collections, which I want to compare to get a certain value based on a variable.
Let me sketch te situation. I have a collection like this, where there a different models that determine the worth of something based on the months the product is old.
Collection name: "Value"
| Name: | Month1: | Month2: | Month3 | Month4: | Month5: |
| ModelX | 75% | 70% | 65% | 60% | 55% |
| ModelY | 70% | 60% | 50% | 40% | 30% |
The second collection has a row with name, a selected model from the collection above., a starting price and the age in months. Based on that I want to calculate te current prize.
Collection name: "Products"
| Name: | Model: | starting Price | Age (in months) | Current price |
| ProductX | ModelX | €100,- | 2 | ? |
| ProductY | ModelY | €50,- | 3 | ? |
For example ProductX was €100 at the start but because it's 2 months old it should only have 70% left off the starting price. So €70,-. ProductY should take modelY to get the current price to 50%, which would be €25,- left.
So basically I'm looking for a way to get the right percentage based on the selected model and age in months from another collection. And then use it to calculate the current prize based on the start price and the right percentage.
Can someone help me figure this out?
Thanks in advance!