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.

Case -Replace

Featured Replies

  • Newbies

I have FM12Pro adv and FMServe 12 pro. and Win7.

------------------------------------------------------------------------------------------------------

Trying to perform a CASE and REPLACE but not working  so good.

I have a Script,which should replace (number) Field "FrUSA" in Database " Allfreights" linking "Shport'fields" both sides.

=============

Case(
T01_ACCOUNTS::Shport="Houston";"800";
T01_ACCOUNTS::Shport="New York";"1200";
)

=============

(this is just an short example of Shipping ports,total file upto 600+ destinations in same script.)

 

If I make a Trial Script with only one line : T01_ACCOUNTS::Shport="Houston";"800"; then all other destination are set to blank,empty.

 

If I run the total scrips (600+) then only a part of it is updated/replaced, but about half of its fields FrUSA are set to zero (0)

 

Where is the error ??

 

Thanks for helping me out.

Willlaim

 

 

With that may ports you would be better off storing those in a table of their own and picking up the correct number through a relationship, instead of a massive case statement.

 

As to why it fails: impossible to say from what you are posting.  The case statement logic seems ok.  If some records update and others do not I would suspect that the relationship from where you are to T01_ACCOUNTS does not always work.

There is no default result, which should be the original content of the field

Automatic message

This topic has been moved from "FileMaker Pro 12" to "Calculation Engine (Define Fields)".

 

The General Topic Areas are for discussion of the new features, tools and functions that were introduced in that version, and not for asking How-To questions.

Both spot-on responses. Your calc doesn't address records which aren't Houston and aren't New York so as Henk suggests, you need to decide the default value for other cities. If they should remain unchanged then you insert the field again as:

Case(

T01_ACCOUNTS::Shport="Houston";"800";

T01_ACCOUNTS::Shport="New York";"1200";

T01_ACCOUNTS::Shport

)

But like Wim, I wonder about the relationship so if calc change doesn't resolve it then we need more information such as full script and how the tables are related or a zipped copy of your file.

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.