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.

Trying to avoid duplicate windows

Featured Replies

Hi

 

I have 3 tables in a Fpro 12 file:

 

Jobs

Clients

Partners

 

I'm trying to do something that I always found quite simple when I kept files separate, but which I'm finding difficult with the 3 tables in 1 file. Namely, include a step in a script which brings another table to the foreground. What I'm finding especially difficult is:

 

1. Avoiding duplicate windows. So, if I'm in 'Jobs', and want to go to 'Clients', I ant my simple script to say, "if there is already a window called Clients open, bring it to the foreground, but if it's not already open, open it then bring it to the foreground.

 

2. Going to related records. I'm finding that when in Jobs I run the script 'Go to related record in Clients', what happens is the Jobs window changes to Clients, whereas what I want is for a new Clients window to open (if there isn;t already one open) and for it to come to the foreground, without closing Jobs.

 

I'm not a beginner exactly, but very easily out of my depth.

 

Any advice much appreciated!

 

Thanks

 

 

Avoiding duplicate windows.

 

Check if the window is open by using the design function WindowNames; e.g. …

Set Variable [ $windowTitle ; value: "Clients" ) 
If [ isEmpty ( FilterValues ( WindowNames ; $windowTitle ) ) ]
  New Window [ from: Clients; New window ; title: $windowTitle … etc ]
Else
  Select Window ( $windowTitle ]
End If

Going to related records.

 

Use the New Window option of the GTRR step, e.g. …

Set Variable [ $windowTitle ; value: "Clients" ) 
If [ isEmpty ( FilterValues ( WindowNames ; $windowTitle ) ) ]
  Go to Related Record [ from: Clients; New window ; title: $windowTitle … etc ]
Else
  Select Window ( $windowTitle ]
End If

Note that you could use a dedicated checking script that you pass the window name as a parameter; the script could either halt the entire flow after selecting an existing window, or return control to the calling script which then creates a new window, maybe using GTRR.  

 

I'm not a beginner exactly, but very easily out of my depth.

 

Try to come up with a plan, then try to find the functions to implement that strategy (aka an algorithm) e.g. “What information do I need to avoid duplicate windows?” A list of existing windows. “How do I get that?” … etc.  

 

The more you rummage through the available functions (or study them with a more methodical approach), the better you'll know what's possible and what isn't and how to best approach the problem.

  • Author

Thanks very much EOS. BIG help.

 

I'll look forward to implementing that this afternoon.

 

Philip

  • Author

Hi EOS

 

Not quite there yet! In the piece below:

 

If [ isEmpty ( FilterValues ( WindowNames ; $windowTitle ) ) ]
  New Window [ from: Clients; New window ; title: $windowTitle etc ]

 

I'm getting stuck on the 'New window' step. When I put in the 'New window' function, I have the option of either:

 

a) giving the new window a name i.e."Clients"

B) setting the name as a calculation

 

What i can't seem to do is get the "[ from: Clients; New window ; title: $windowTitle  etc ]" bit.

 

You couldn't enlighten me could you? Thank you.

I'm getting stuck on the 'New window' step. When I put in the 'New window' function, I have the option of either:

 

a) giving the new window a name i.e."Clients"

:cool: setting the name as a calculation

 

What i can't seem to do is get the "[ from: Clients; New window ; title: $windowTitle  etc ]" bit.

 

You couldn't enlighten me could you? Thank you.

 

I guess I could, at that …  :laugh:

 

Open the calculation dialog and simply enter

 

$windowTitle

 

(no quotes!) which is the variable name you set at the script's beginning (to guarantee consistent window naming/handling).

  • Author

ah - thanks EOS!

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.