Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Find/Replace script triggers "page up"


Recommended Posts

I'm designing a database which allows teachers to compile a value list of often-used phrases (i.e. Johnny is able to read at an age-appropriate level), which they can paste into an 'Assessment Result' field, which is half-way down the layout. I've given them the option of using [Name] in the value list, and I've created a simple script to replace [Name] with the child's name. The script works fine, but for some reason, it takes the user to the top of the layout.


I added a "scroll down" command at the end of the Replace Name script, but depending on the screen size the teacher is using, the scroll down command doesn't always take them back to the Assessment layout. I added a "Go to assessment field" command, but that doesn't solve the problem either.


I'm wondering why the Replace Gender script takes me to the top of the layout in the first place. Any ideas?




Link to comment
Share on other sites

Find/Replace is one of the "didn't think it thru" features that Fm Inc rolled out and unleashed on an unsuspecting world.*


In your case it's probably as good an approach as any, but the problem that is affecting you here is that F & R actually literally goes INTO each field, thus causing screen repositioning just as if you'd tabbed your way through the tab order.


By "Assessment Layout" I assume you do not literally mean "a separate layout" but instead a section of the SAME screen they started out on?


You could try an IF statement assessing Status(CurrentScreenHeight) and experiment with how many Page Downs are needed to get it approximately back to origin point based on this screen size and that screen size and this other screen size. Smaller the screen, the more times you have to invoke a scroll DOWN to get back to where you want to be.





*Good old F & R...I remember when it debuted in FmPro 6, some of us dubbed it "Search and Destroy" because you could wreak so much havoc with it with such little effort. The command sits right there in the all-too-available Edit Menu. Replace every occurrence of "ops" with "oops", accidentally choosing to do that for every field of every layout of every record in the system? ::visceral shudder:: {Janitorial supplies now includes listings for dust moops; you know that IT report on CPU speed comparisons? It now makes several references to the performance of various chips measured in gigafloops; the quality control notes on the Quark ad now indicates that the image looks a bit loopsided; and of the fate of that PepsiCo subsummary report on various soda pops, the less said the better...}

Link to comment
Share on other sites

Thanks AHunter. At least you've confirmed that the screw-up isn't mine. Your explanation about how the F & R works cleared up my confusion. And to think that when I chose the "Current Field" button, I mistakenly thought it would only look at the current field. How silly of me! smiley-smile


Yep, the Assessment Layout fields are on the same screen as the script button layout. I learned the hard way that FM won't paste data into fields that are in a different layout. Sigh...more short-comings of FM (at least the older versions)


Anyway, thank you very much for your help! I appreciate it.

Link to comment
Share on other sites

It will not PASTE data into fields that are not on current layout but you can SET FIELD [specify Field; "Value To Set It To"] whether it is on current layout or not.


Mostly, experienced programmers often go for years without using Cut, Copy or Paste as script steps. I won't say they do not have any legitimate purpose, but they are mostly outmoded carryovers from FileMaker version 2 and earlier.


EDIT: I should clear up a possible misunderstanding. I did not mean to imply that Find/Replace always & unavoidably finds and replaces on all records / all layouts etc. It has several options. That just happens to be one of them, and newbies, who aren't always real clear on what is a layout and what is a record, etc, can choose that option and ruin lots of data all in one move. But it can be restricted to current layout / current record only.


ALSO, the Set Field script step mentioned above will fix your scrolling problem, but I did not mention it previously because you have to specify what field to set, and I was under the impression that you were replacing "[Name]" with the actual person's name in dozens of fields. So Find/Replace (even though it causes the scrolling issue) seemed more elegant than


Set Field [Field A, Substitute (Field A, "[Name]", Child's Name)]

Set Field [Field B, Substitute (Field B, "[Name]", Child's Name)]

etc etc for 20 or 30 some-odd fields.


But if you've only got a handful of fields maybe you'd want to use that technique. Set Field will not make your users' screens scroll.

Link to comment
Share on other sites

Set Field [Field A, Substitute (Field A, "[Name]", Child's Name)]


Yes!! That did the trick, thanks! I was under the mistaken belief that Set Field always replaced the entire contents of that field. I didn't think about the substitution option. You've saved what little sanity I have left...my 3 remaining brain cells thank you. smiley-wink

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use