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.

Relationship based on global

Featured Replies

I have a global calc field, gA, in Table I. Its result is based on another another global field, gB. Table I has 0 records -- it just holds the global values.

I have a layout based on a second table, Table II. (Table II is in another file, but that shouldn't matter.) On this layout I want to use the portal visibility technique to show objects based on gA, so that if gA=1 the portal is visible, otherwise it is hidden.

Table II has a field C, which is an auto-entered text field with a constant 1. I've created a relationship between gA and C, and placed a portal based on this relationship on the layout.

So, if gA=1 and C=1 (by definition) the portal should display objects. But this isn't working. If I put gA and C directly on the layout they show the correct values. But the relationship doesn't work right.

What am I doing wrong?

Something like this?

It appears to work, except the portal doesn't refresh automatically.

  • Author

Yeah, that's basically what I've been playing with. It seems to be getting screwed up on the globals. If I make gA a plain number and set it manually (or with a script eventually) it all works. (It can, in effect, act like a global in this situation since the table can have just 1 record and it will be a constant for all users.) If I make it a global calc or just a regular calc it doesn't work.

This may be something of a bug. If I set up a field as a calc, immediately go to the storage tab and set it as a global, and then define the calc, it accepts it. If I set up the calc field, define it, and then try to set the storage option to global, it tells me it won't work since it is referencing another global field. Weird.

Anyway, thanks for the help. All this would be solved if FM would get more object oriented, and let us directly disable or hide objects based on calculated conditions. When is FM 8 due? smile.gif

Thanks,

Dan

Yeah, that would be great, I fantasize about using properties, maybe something like:

SetProperty( Get( LastButtonPressed ); "Caption"; "Processing..." )

To change a "Run It" button to "Processing" while the script is working on whatever.

I've used Delphi a lot, and everything had dozens of properties for every object that were controllable like that, it rules. Things like that allow being able to make a portal larger automatically when the window is resized - very nice.

I see what you mean Dan. A calculation field with the global doesn't refresh very easily. It does however work. See hacked attachment.

visible_wGlobals.zip

  • Author

Ah, clever. I'm still putting this all together in my head. Thanks.

I was hoping not to have to rely too much on using the data table since I'm trying to split the data from the script / layout file. But if I use a 3-file separation model (data, script/layouts, and calcs) then I should be able to build this into the more-easily-modifiable calc file.

Thanks again,

Dan

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.