Jump to content

A CHALLENGE FOR SCRIPT EXPERTS :)


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

Recommended Posts

Here is what I want to do:

I have 3 files: Lists, List_Items, and Tasks.

Lists has 1 field called List_ID which is the match field for a relationship to List_Items. In the Lists file I have a portal that accesses List_Items. Everything works great. I can create records, delets, etc. from the portal.

Here's the challenge:

I want to create "quick add" buttons in the Lists file that automatically add a new record to the portal based on a task ID. I can accomplish this fine if I hard code the task_ID into the script. However, doing this will force me to create a script for every button (there are going to be at least 50 buttons like this, that's 50 scripts). What I would like to do is create a script that can be re-used for each button and will look up the value of Task_ID based upon which button is clicked. Even at this point I would still have to assign some sort of identifying value to each button so the script could evaluate the Task_ID. Is there any way around this? Is this outside FileMaker's range of capability?

Can't wait to hear your responses!

Thanks! smile.gif" border="0

Link to comment
Share on other sites

Create portal to the tasks files. Place a button in the portal that runs a script that sets a global field to the contents of the related task_ID field, then continue your quick add script from there using the task ID in the global to determine the task. You only need to create one script and attach it to the button once, but the portal will show a button for every item displayed in the portal.

Link to comment
Share on other sites

Basically I want to add buttons at the top of the screen that allow "comon" tasks to be added quickly. Infrequent tasks can be added manually from a pull down in the List_Items portal. The buttons are basically associated with a task_ID (right now they are hard coded). Since clicking a "quick add" button is doing the same task over and over (selecting the associated task_ID and pasting it into a new portal row) I am trying to find a way to dynamically associate a button with the add script. I really dont' think this is possible since the button itself has no attributes. If I could give the button some sort of field name or attribute I could pull the task_id from the attribute.

Any ideas? I'm stumped.

Thanks

Link to comment
Share on other sites

You want the user to be able to assign some one of a number of common tasks to a given button? Right?

How about a popup under the button that when the button is clicked, looks to see what value is entered into the field from the popup, and then branches a script accordingly?

I still am not certain from your description what you're trying to do here.

Old Advance Man

Link to comment
Share on other sites

You've got the idea here. However, I am trying to avoid having the user go to a list to select a task. If they have to do that I can just add tasks from the list.

What I really want are buttons with "pre-assigned" tasks (hence the hard coding of task_ID's) so the user just clicks the button and the task is added. That's why I would need some way to associate the task_ID with the button. The task selection should be transparent to the user.

In other words the user clicks a button like "Add X to list" and X is automatically added. I am looking for a way to do this with one universal script. It would just make the coding cleaner, that's all.

Thanks for your replies so far. It helps to have someone to bounce ideas off when I'm working through a problem.

Link to comment
Share on other sites

I think I know what you are attempting here. How about a global field that is assigned by a two line script. You would need one of these scripts for each of the task adding buttons. The script would assign the ID to the global field, and then the second function of this simple script would be to call the "generic" script that would add the record, and use the value from the global field as required to identify which button was pushed. I am not sure if I am making sense.

Link to comment
Share on other sites

I assume that the "List_Items" contains both list_id and task_id (from "Tasks").

You can have a "pop-up" menu assigned to the "task_id" field in the portal. This pop-up would display a valuelist generated from the "task_id" field in the "Task" table/database.

The portal usually displays a blank row 'ready for creation'. When an item is selected from the pop-up a new portal row is usually created.

We use this for adding items, from a price-list, to rows in a quote.

All the best.

Garry

Link to comment
Share on other sites

Hi Everyone

In thinking about this problem over the last couple of days I've pretty much concluded that it's not possible to do withtin the limitations of FileMaker.

I guess that my dealings with web authoring is showing through in my logic. You see, in the universe of web site building it is possible to assign a number of attributes to any object. When I build for the web I can create a script. I can then attach an attribute to the button itself, the button being the graphic. I can then call the graphic by it's attribute in the script. This way I can code the variable(field,global,etc.)into my graphic and I'm done.

All of you have offered great suggestions.

What I really want is to be able to is create a FileMaker button (graphic) and assign the variable to it. This would allow me to create the variable independent of any script and just use a script that evaluates the value of the variable(task_id) from the graphic (button).

Thanks to all who posted!

Happy FileMaking!

[ January 19, 2002: Message edited by: ncasares ]

Link to comment
Share on other sites

You are right. You can't assign a variable to a button, but if you are willing to tolerate a bit less flexibility, and use a vertical row of buttons, you can still accomplish this with a portal/button arrangement. Rather than post the method here, I posted it as a new topic:

http://www.fmforums.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=8&t=000035

I also created a sample file that I can email you, if you like.

Link to comment
Share on other sites

This topic is 7215 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.