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.

Featured Replies

  • Newbies

I need to update regularly my database COMPANIES field "Freight" with a certain value like:

If [Companies::Shippingport ="Rotterdam"]

Replace Field Contents [No Dialog;Companies::Freight;"1500"]

End If

If [Companies::Shippingport ="Houston"]

Replace Field Contents [No Dialog;Companies::Freight;"1000"]

End If

etc etc

with 200 Different Shippingport,Differents Freights.

HOW TO DO THIS in a script ??

Thanks for the help.

William

It would probably be best to retrieve the value from another table via a relationship, based on matching shipping port. It's not quite clear to me what your workflow is here, though.

Hi William, welcome to FMForums! :laugh2:

With 200 different shipping ports and rates, another table would certainly be in your best interest but a few points just for future about the script you are attempting to construct:

Replace Field Contents[] runs through the entire record set and not one record at a time so you would have ended up with Freight field in all records having the value of your last test. So with a set of records, you would use Replace Field Contents[] only once and instead put the 'test' within a calculation (in blue) itself as:

Replace Field Contents [ Companies::Freight ;

Case (

Companies::Shippingport ="Rotterdam" ; 1500 ;

Companies::Shippingport ="Houston" ; 1000 ;

... etc

)

But using another table as Comment suggests is the most logical in this instance. It is best not to hard-code values (your freight rates) into calculations because each time the rate changes, a developer would need to open field definitions to change it. Using another table is also more efficient and flexible. Replace Field Contents[] is unsafe if Users are in the system because record locking can't be detected (on per record basis) so only use it if you are sure Users won't interfere (stops the field from receiving the changed value), otherwise use a loop and Set Field[].

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.