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.

condition based view (filemaker newb)

Featured Replies

Hi,

I'm developing a new database at my job, and I'm new to how the filemaker scriptmaker works.

I would like to have a script that checks the contents of a field and brings up the view that relates to that field.

I'm dealing with a database that records technical information about many different types of recorded mediums. I need to be able to display the physical characteristics of each medium, based on the code for that medium. So if in the medium for a filemaker record is "cassette" I would like the database to display the casette characteristics view when the user hits a characteristics view button.

basically: on button if medium == cassette go to cassette view elseif [next medium]....

except that i have many types of mediums.

I've been working with the manual but with little luck getting the scriptmaker to work. any hints or tips out there.

thanks,

-Don

Here is one way to do this with an IF statement.

You will need to have your alternative layouts already produced so that you can allude to them in the script dialog editor.

When you open the Scriptmaker Dialog Box, click on the IF statement

This will take you to a second screen where you want to select the field that holds the value you want to refer to.

Fill in the rest of the script as follows:

IF(Field A)= X

GOTOLAYOUT (Layout X)

ELSE

IF(Field A) = Y

GOTOLAYOUT (LayoutY)

There are probably easier ways to do it, but this will get you started.

PS: this is my first help hint. Thank you.

  • Author

ok this is what the scriptmaker looks like right now, but when I click on the button i have setup for this action nothing happens.

If ["Item_medium = "Analog cassette tape""]

Go to Layout ["casette"]

End If

----

am I missing something very obvious??

Is there more in the field than just "Analog cassette tape"?

PatternCount might work better for you.

If [PatternCount( Lower(Item_medium), "analog cassette tape" )]

Go to Layout [cassette]

End If

Hi Don,

Here's a slightly more involved solution, but given that you have "many types of mediums", it might be better in the long run:

Create an additional table (Layouts.fp5)that has two fields: Item_Medium & Layout_Name. My assumption is that for each type of medium, you want to have a seperate layout and that you've already created those layouts in your main table.

For each type of media you deal with, you'll have a corresponding record in Layouts.fp5 along with the layout name that each medium should be associated with.

Create a relationship from your main table to Layouts.fp5 that is linked by the Item_Medium fields in both tables. When you click on a button, the script looks through the relationship (and again, the relationship is based on the value in the Item_Medium field) to determine which layout to go to. Your script looks something like this:

Go To Layout (relationship::Layout_Name)

This gets away from having lots of If/Then/Else script steps and allows for things to be a bit more dynamic. If for some reason you need to change up layouts, you won't need to go digging through a bunch of If statements - you'll just change the assignment in your Layouts.fp5 table.

  • Author

DOh!

Ok figured out the problem. I had the buttons originally up in the header (made for clean navigation). Of course the script doesnt know what record to look at if the button isnt attached to the record. uggh. I guess you just have to learn some things the hard way.

Thanks for the layout table tip. I'll try to integrate that tommorow, makes much more logical sense.

-Don

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.