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.

Price - word count calculation

Featured Replies

I have a classified advertising database and I need it to figure the following for an ad based on word count.

It costs $40 for a minimum of 25 words and an additional $1.50 a word over 25.

I would like to be able to keep it where the dollar amount and word count can go up over time.

Thanks...and I am extremely new to FMP.

This is how I would approach it. Use a preferences table so that you can change the criteria in the future. The preferences table would serve as a lookup price list each time a new Ad record would be created.

Advertising.zip

I would lookup/auto-enter the pricing into three fields:

- MinimumWords

- BasePrice

- ExtraPrice

then calculate the price as:

BasePrice + ExtraPrice * Max ( 0 ; cCountWords - MinimumWords )

Edited by Guest
Misunderstood the nature of the relationship in John's file

Let (

diff = cTotalWords - Ad_MaxWords_TierOne;

Case ( cTotalWords; Ad_Price_TierOne + diff * Advertising_SJ::Ad_Price_TierTwo )

)

The problem with this calculation is if cTotalWords is under the TeirOne max you could actually end up with a negative price which is definitely not what you want. I would change the function to look more like comments so:

Let (

overage = cTotalWords - Ad_MaxWords_TierOne;

Ad_Price_TierOne + if( overage > 0 ; overage * Advertising_SJ::Ad_Price_TierTwo )

)

you can add an if condition in there to determine if the words are positive first too.... depending on how nit picky you want to get.

As far as which solution is better, either one is fine. I definitely like the idea of having some type of preference table because then non-"[Full Access]" users can edit the data. I don't think hard coding in the values is the way to go.

I dont see what you mean. If the difference comes out negative, that would also mean that that cTotalWords < Ad_MaxWords_TierOne, which in turn would make Advertising_SJ::Ad_Price_ TierTwo empty. Regardless of the sign of the diff, when multipled by Advertising_SJ::Ad_Price_ TierTwo, it would turn to zero and therefore default to:

Ad_Price_TierOne + 0, which in this case would equal $40.00

Create an account or sign in to comment

Important Information

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

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.