Skip 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.

Calculation using script or CDML???

Featured Replies

Hi, I have a field called quantity and a form on the web where a user can remove or add a certain quantity of the record using an input form. Supposing I have the recID, how do I update this? I don't want to edit it cause that will replace the value. Do I use a script when they click the submit button?

Ohhhh...I'm getting vibes from the FMP Psychic Hotline...its saying you need to use calculation fields to accomplish the calc CaptKurt tried to explained to you in a post under 'Scripting'...

quote:

Simply make your TOTAL field a calculation, like the following: TOTAL = VALUE - ADJUSTMENT.

I'm assuming you plan to have multiple records for the same 'Item', something like several orders that will be subtracted from the original amount. There are lots of ways to do what you want. Below is a 'simple to understand' solution using two databases (DB_A and DB_???:

DB_A has the following fields:

"Item Number" - a unique number designating the item - basis of relationship to DB_B.

"Item Description" - description of the item.

"Quantity" - number field where you input the starting quantity.

"SUMAdd" - a calculated field using the Sum function and the 'Add' field from DB_B .

"SUMRemove" - a calculated field using the Sum function and the 'Remove' field from DB_B.

"Total" - a calculated field where TOTAL = Quantity + SUMAdd - SUMRemove.

DB_B has these fields:

"ItemNumber" - Number to that matches an Item Number in DB_A.

"Remove" - a number field where you input the amount to remove.

"Add" - a number field where you input the amount to add.

"OrderNumber" - A unique number for this order.

"Person" - name of the person, or any other identifying fields so you know whose order this is.

On the HTML page, use related fields (i.e., [FMP-Field:DatabaseA::Quantity]) to display the original Quantity, Remaining Quantity, etc. from DB_A. Users would create or edit the record in DB_B, entering a number in the Add or Remove field on the HTML page. A new or edited record would be done using Submit Form.

If you have questions about these fields, about setting up relationships, etc., USE YOUR FMP HELP BUTTON to learn more - in particular, you'll want to learn the difference between a summary field and the Sum function. The built-in FMP help feature is pretty good for basics. ;-)

[ July 13, 2001: Message edited by: MeltDown ]

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.