Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lookup Value Within A Range

Featured Replies

Hi Everyone,

I've got what I hope to be a quick question with a relatively simple answer. I'm new to FMP so this may be easier than I'm making it out to be.

What I want to do is set up a layout that will calculate purchase order prices based on quantity. I've got a table of part numbers with the respective "price breaks" per quantity. For example a qty of 10,000 units might cost $2 per unit, qty of 15,000 = $1.50... etc. The problem is that the price breaks are different for each item number. Where item "A" may cost $2 at 10,000 units, item "B" could be $10 at 10,000 units. I need to be able to input a quantity and have a calculated field (or script?) that will reference the item number and quantity, and return the appropriate price break.

I've been trying to "logic-out" the guts in Excel and am getting stuck there as well. Any input would be GREATLY appreciated.

Is it just a single price break for each item?

Case( qty <= break_qty ; priceA ; priceB )

If each item has multiple breaks, then something like this:

Case( qty <= qtyA ; priceA ; qty <= qtyB ; priceB ; etc.)

Does that make sense? In both examples, the values on the right-hand side of the "<=" are related values from your part numbers table.

  • Author

Thanks for your feedback. I got the formula working in Excel by using a vlookup. Now I just have to recreate in FMP somehow. Correct me if I'm wrong, but the "Case" function sounds kind of like an If statement. If (condition, value if true, value if false)...

I'll tinker with this and see if it works. Thanks!

Case is less cumbersome if you have more than one condition to evaluate.
  • Author

I don't know if I'm doing this wrong, but only the first two tests work. If my buy quantity is less than 10000, the test returns the "20000 unit price). Here is what I've got input.

Case ( Qty ≥ "20000" ; 20k Price ; Qty ≥ "10000" and Qty < "20000" ; 10k Price ; Qty ≥ "7500" and Qty < "10000" ; 7.5K Price ; Qty ≥ "5000" and Qty < "7500" ; 5k Price ; 5k Price )

In the event that buy qty is less than 5000 units I want the 5k Price... hence the last "5k Price" argument.

I suggest you look at these:

http://www.fmforums.com/forum/showpost.php?post/294096/

http://fmforums.com/forum/showpost.php?post/300768/

  • Author

Thanks for your comment, Comment. I created a price list table that lists out each price break qty and price for every item... kinda like what you mention here: http://fmforums.com/forum/showtopic.php?tid/195995/post/294096/#294096

What I don't know how to do now is setup the calculation. I want to be able to enter a PO quantity for an item and have it look up the corresponding price (or the next lowest break if in-between values). Can you give me an example of what this might look like?

That's what the other thread explains. Note that this shouldn't be a calculation: you want to really lookup the price, i.e. copy the value into a field in the line items table. This ensures existing records will not be modified when the prices change.

  • Author

Ok I got it working... sort of. I'm running into a snag when trying to lookup multiple buy quantities. For example, I want to enter a purchasing schedule...

PO 1 Qty: 20000 units

PO 2 Qty: 10000 units

PO 3 Qty: 5000 units

Final PO: 2500 units

I would like it to lookup the price breaks for these quantities, but what is happening is it only looks up the first field "PO 1 Qty" and doesn't analyze the others. Ideas? I think it's just an issue with my relationships, but not sure.

No, the issue is with having multiple fields for the purchased products, instead of multiple records - see:

http://fmforums.com/forum/showpost.php?post/309136/

  • Author

Ok I got everything working, with the exception of one little quirk. When I enter the quantity for the first purchase order the pricelookup doesn't return any value. However once I enter the second purchase order the lookup works, and I can then go back and enter the first quantity and it will reference price. My assumption is that it has something to do with the "Lookup Next" function, but I could be entirely wrong. Any ideas?

Not really. Perhaps you should post your file (preferably simplified to show only the problem).

BTW, I wouldn't use lookup next when the relationship is based on two matchfields.

  • 2 months later...

Hi did you ever get this to work for you. Jay.

Need similar help.

Hi Barbara thanks for your link I sent a PT or something like that. Jay.

Got your pt. But, I prefer any questions to be added to this thread, bcs many people learn from our discussion.

Notice the new table PriceList and the relationship from Line Items to PriceList has two predicates. That is essentially the key to this technique. What didn't you understand about the demo?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.