Jarvis Posted July 5, 2005 Posted July 5, 2005 I have a series of SET FIELD scripts that change the name of the WORKER OF THE MOMENT to the names of various workers. I would like to script a PERFORM FIND that uses as its search criteria the current value in the field WORKER OF THE MOMENT. I would like this script to be activated with a button without any additional input from the user. Is this possible? Thanks, Jarvis
aaa Posted July 5, 2005 Posted July 5, 2005 Such? Enter Find mode Set field[worker,WORKER OF THE MOMENT] Perform Find Are i understand you clear? I need that field "WORKER OF THE MOMENT" is global field.
Fenton Posted July 5, 2005 Posted July 5, 2005 On 7 you can also use the Script Parameter option. When you assign the button to a script, at the bottom choose the "Worker" field as the script parameter. The script is: Enter Find mode Set field [ worker, Get ( ScriptParameter ) ] Perform Find
Jarvis Posted July 5, 2005 Author Posted July 5, 2005 Fenton & aaa, I don't know if I am explaining myself well. It could also be that what I want to do cannot be done. What I am hoping to do is to script a find that always uses the current value from WORKER OF THE MOMENT as it's FIND CRITERIA. If WORKER OF THE MOMENT is "Billybob", I would like the script to automatically search for all records with the value "Billybob". If WORKER OF THE MOMENT is "Skippy", I would like the script to automatically search for all records with the value "Skippy". I don't want the user to have to select any particular criteria or script parameter. I just want them to select the FIND BUTTON and have the FIND script recognize that resident value in WORKER OF THE MOMENT is the criteria to search for. Could this maybe be done with a custom function or plugin? Thanks again for any ideas, Jarvis
LaRetta Posted July 5, 2005 Posted July 5, 2005 Hi Jarvis, So if someone is on a specific record, and the Worker Of The Moment 'on that record' is Billy, you want them to click a button and find all of Billy's records? Even if WorkerOfTheMoment is global, this will still work. Whatever is in that field will be grabbed. It's exactly what we talked about regarding Script Parameters. Create script exactly as Fenton said. Create your button, attach Fenton's script in Specify Button and (in Edit calculation box), insert your WorkerOfTheMoment FIELD - not text but the field itself! When script enters Find, it will use the VALUE from the field as the find critera (replaces 'Get(ScriptParameter' with "Billy". Script Parameters! Gotta love em - and ideal for dynamic finding. If we're still missing the boat, you need to explain a bit more. LaRetta
Jarvis Posted July 5, 2005 Author Posted July 5, 2005 Awesome stuff these script parameters! Now if I could just get rid of that pesky continue button my work would be done. Thanks guys (and gal(s))! Jarvis
LaRetta Posted July 5, 2005 Posted July 5, 2005 Set Error Capture [ On ] Right before your find. Trap for errors yourself. And never Pause ... in anything
-Queue- Posted July 5, 2005 Posted July 5, 2005 Continue button? Do you have 'pause' selected on the Enter Find Mode step?
Fenton Posted July 5, 2005 Posted July 5, 2005 If you left "Pause" checked in the Enter Find Mode step, then you'll see a "Continue" button; otherwise not. You certainly don't need a pause.
LaRetta Posted July 5, 2005 Posted July 5, 2005 JT, Fenton, I'll say it for you ... "God, that girl is fast!!!"
Korky Posted July 7, 2005 Posted July 7, 2005 I'm trying to achieve exactly the same as Jarvis and the fact seems to be that "Set Field" does not work in Find mode (in Dev 7). I have used it many times in previous versions, but cannot get it to work now.When Fenton's script is run an error dialog appears saying that there are no search criteria. What's to be done?
LaRetta Posted July 8, 2005 Posted July 8, 2005 Korky said ... and the fact seems to be that "Set Field" does not work in Find mode (in Dev 7) Holy cow! That means a genie has been making all my finds work in Developer 7 for almost two years!!! And he's been busy - at least 25 finds a day using various Set Field script-steps!! We're teasin' ya Korky of course Usually it is something like entering something wonky in the calculation box of Set Field [ ], executing the script without being on the correct table when it fires (some steps require being on the correct layout), or already having a stored find request. If you are having problems in vs. 7 that you didn't have before I guarantee you there are logical reasons ... we just need to pinpoint them. Can you post your script or your file or at least tell us what you are attempting to find (and the field types) so we can give you ideas? Otherwise we'll just have to use our dart boards to come up with answers. Jarvis got his working. I hope we can get yours working also. If using script parameter, Korky, did you select the button and attach the script parameter in the Edit Box in Specify Button? LaRetta
Korky Posted July 8, 2005 Posted July 8, 2005 I don't know about a genie making your "Finds" work, but a gremlin is at work with me. I have run the same script in v5.5, and it doesn't work their either. In Dev7 I have run the debugger and no step will function after "Enter Find Mode" (the various buttons are greyed out).
LaRetta Posted July 8, 2005 Posted July 8, 2005 The script Fenton presented will NOT work in vs. 5.5 because it requires Get(ScriptParameter). Again, Korky, would you like to give us your specific script or situation? I also see a lot of people get Perform Find/Replace confused with Perform Find. It is an easy misconception. Be sure you selecting Perform Find [] from the Found Sets section.
Korky Posted July 8, 2005 Posted July 8, 2005 Sorry but I pressed "Go" to soon. Here's the file. I just created it a few minutes ago as a test. It has two text fields and the script is simply; Enter Find Mode Set Field(Field 2;Field 1) The script pauses in Find Mode. I have also attempted the Paste step with equal lack of success. Findscript.zip
Korky Posted July 8, 2005 Posted July 8, 2005 The script Fenton presented will NOT work in vs. 5.5 because it requires Get(ScriptParameter). The script was amended accordingly.
LaRetta Posted July 8, 2005 Posted July 8, 2005 A few things here ... you may have amended the script 'accordingly' but you are correct ... this will not work. You are attempting to use data from field 1 for your find, but you make that request while in Find Mode. While in Find, there IS no data in field 1. And notice that Fenton had a Perform Find at the end? That step is ALWAYS required to trigger your find. There are a few more problems with it as well. 1) You have no button. Without a button, you can not attach a Script Paramater. And you need some way to transfer the data from field 1 into your find while still in Browse mode. So if you don't have a button, you need to write that field 1 data to a global to hold it - and then pass it to your Find script-step. 2) You have no second record which contains the words 'anything' in field 2. It would find nothing anyway. Create a second record and type 'anything' into field 2 so you will know if it's working during these tests. 3) You are missing a Perform Find [] as the last line. So ... will Users be activating this script via a button? Or will you be running this automatically in the background? I can give you a working script either way you choose ... just let me know!
Korky Posted July 8, 2005 Posted July 8, 2005 The actual execution of the Find is not the issue. It is that the script fails after Find mode is entered.I mentioned in an earlier post that the Paste (as well as Set Field)step will not work either. My script follows the pattern of the example submitted by "Enthusiast" above except for the omission of the Perform Find step.No one has faulted that. If you are using Set Field in Find Mode, what values are you setting if not a field content or based on a Field?
LaRetta Posted July 8, 2005 Posted July 8, 2005 The actual execution of the Find is not the issue? 'Enthusiast' is Jarvis, I assume? His Find failed also until he modified his Find as was suggested. If you are using Set Field in Find Mode, what values are you setting if not a field content or based on a Field? You must allow a User to enter the criteria ... or provide the criteria yourself. But if you want to dynamically grab a value from a field, you must, errrr, grab it dynamically. Why your Paste[] script failed, I couldn't say. But from the example of your script, I would suspect many reasons could have fouled it. But if you don't answer my question on what type of find you want, I can't give you an answer. Would you like a demo back showing both methods I discussed? One with button and one without?
Ender Posted July 8, 2005 Posted July 8, 2005 Korky, Only global values are visible in Find Mode. This is because record values have no meaning in Find Mode (you're not on a record in Find Mode.) This seems to be the problem with your example file.
Korky Posted July 8, 2005 Posted July 8, 2005 I've solved the problem. I'd forgotten that you need to use a global value in Find Mode.Everything works now.
Korky Posted July 8, 2005 Posted July 8, 2005 The penny had already dropped, but thanks for responding.
LaRetta Posted July 8, 2005 Posted July 8, 2005 "I've solved the problem." Oh. Like I said in Point #1 above. Good to hear and you're welcome.
Recommended Posts
This topic is 7082 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