spankalee Posted March 4, 2005 Posted March 4, 2005 Hello, I just stumbled upon a bug in my system which has brought up an interesting problem. I use a separate window for choosing customers for invoices. The user clicks on the customer name in the invoice and a new window pops up that lets the user do some sorting and searching. Then the user clicks on a customer name which runs a script that populates the customer ID field in the invoice. The problem is that I choose the Invoices window with a Select Window script step and the window name is hard coded to "Invoices". The order people have discovered Window->New Window so sometimes they have a window up called "Invoices - 2" and when they try to select a customer for that window it ends up modifying the wrong invoice. I've been trying to think of a way to pass the original window name to the popup, but I can't figure out a solution I really like (as is typical with FM, I guess). I might be able to wire something up with a global and a script that limits the number of popups to just one. What I really want is a way to make the customer chooser modal. Well, i thought I'd put this to the fmforums crowd to see what you think, or if anyone's dealt with this issue as well. -J
transpower Posted March 4, 2005 Posted March 4, 2005 It may be easier for you to make a value list from your customer table and pop that up for your users.
spankalee Posted March 4, 2005 Author Posted March 4, 2005 The reason I'm not using a pop-up list is because we have 500 customers and growing, and because the invoice stores customer ID and not customer name, the value list has to be from IDs and additionally show names, this means the user can't type the name and get matches in the list. (it'd sure be nice if a value list could have both values and labels, and only show the labels - like HTML and just about every other programming environment out there) But the good news is I've solved the problem!. There's no way to pass a parameter to a window, but I was able to use the window name to store what I need. So in the first script (which opens the dialog) I set the dialog's window name to this: "Choose Customer: " & Get ( WindowName ) Then in the second script (which sets the customer ID and closes the dialog) I choose the right Invoice window like this: Select Window[Name: Right ( Get ( WindowName ) ; Length ( Get ( WindowName ) ) - Length ( "Choose Customer: " ) )] Works like a charm.
Fenton Posted March 4, 2005 Posted March 4, 2005 I have a couple files in the Sample files section that pop up a window to choose from. They use a portal, with a letter-filtered portal, ie., poor-man's Clairvoyance. The window pops up, is given a name, and enters a Loop/pause; which stops users from clicking outside the window until they make a choice or cancel. Typing letters filters the portal. Then you click on a portal row, which runs a script, sets IDs, etc.. It is not perhaps as smooth as a drop-down list. But drop-downs become slow and ugly with a lot of records, whereas a relationship is still fast, on networks and large files. I've used it with 10,000+ names; takes 3-4 letters to narrow it down. The visible scripts must also check for Get (AllowAbortState); which is new to 7. Otherwise visible scripts have no way to Halt a currently running script, and still run themselves. Buttons to leave must stop the Loop, or it continues (not good). Best to severely limit the number of visible scripts.
Recommended Posts
This topic is 7207 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now