Jump to content

Simplify, simplify, simplify


This topic is 8041 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a script that uses a pasted keyword to "Find" all the records for each component of my database. Downstream, I need this same script to change to the one of several layouts that matches my pasted keyword/component. For example, I want to go from artifacts to documents. My script uses the pasted "documents" keyword to find all documents and now needs to switch from the artifact layout to the document layout. Is it possible to have a (single) script switch layouts based on the pasted keyword?

Thanks.

L.

Link to comment
Share on other sites

Sure. You just need some way for FileMaker to figure out which layout you want to go to.

Here's a script that would do the job for two possibilities.

Paste [ Select, gClipboard ]

If [ gClipboard = "documents" ]

Link to comment
Share on other sites

I'm a little confused as to what you mean by "pasted keyword". If this is a value pasted to a field, that value can be tested in a script and use to cause a layout change to a layout based upon the value in the field. If the you are asking if a script can automatically execute based upon a value entered into a field (without the user pressing a button) the answer is 1) not with FM alone and 2) yes using a FM plug-in. -bd

Wow, Chuck, you were posting while I was writing!

[This message has been edited by LiveOak (edited November 28, 2000).]

Link to comment
Share on other sites

BTW, LiveOak, I have used a technique that will execute a script based on the value entered in a field. It isn't perfect, using a Loop to continually see if the value of the field has changed, and exiting if it has. Sometimes there's a delay between the value changing and the script continuing, because I can't set a script to pause for less than 1 second, but if you really need it, it'll do the job.

Chuck

Link to comment
Share on other sites

Chuck and LiveOak,

Hi! Thanks for the speedy response.

I must confess that while you were laboring to respond to my question, I learned of a solution totally unlike your method. In case your interested the following summarizes the approach:

Central to this solution are two parts: 1) to access a layout via a pasted word, convert the word, that corresponds to a layout, to a layout number and 2) select the calculation field, "Calc" in this case, that utilizes the results of the Logical Function "Case" when script step "Go to Layout" and "Layout number given by field" are selected.

Case

(

Category="Artifact", 1,

Category="Document", 2,...

Default Result=0

)

A couple of comments - the calculation field, e.g., "Calc", does not have to be on any layer and FM notes that "Layout numbers correspond to the order of the layouts in the file."

This solution is allowing me to use only one short script with six button choices to access the corresponding data input layout, out of six available layouts. It is better than creating many scripts that have to be maintained.

Thanks again. I hope to work with you both again in the near future.

Cheers.

L.

Link to comment
Share on other sites

I had thought of that, and almost mentioned it. It's a good solution, just make sure that you don't rearrange the layouts, otherwise your script could break.

Chuck

Link to comment
Share on other sites

Be aware that the Recover command resets the layout order to the order in which they were created, so if at any time you need to recover the file you can be sure that the scripts will probably break.

Link to comment
Share on other sites

This topic is 8041 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.