Jump to content



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

Recommended Posts


I'm a new FM user. Glad I found this site, I'm hoping someone can offer some answers that I haven't been able to find.

I'm trying to modify a pre-made invoice solution in FM 8.5 advanced, one of the scripts is named "-" and it has steps like this one"

//set field [sales Orders::bill to name;"name"]

I know that this inserts the word "name" into the field but I can't find out how or where this script is executed.

Is this something only a mac can write? It was really hard even finding this script.Until now I thought the "-" was just to separate script steps for easy reading.I can't find anywhere in the solution where something calls up the scriptnamed - or how to write a step that begins with //

My second question is more complicated. I added another database for salesmen with unique id's

I was able to add a field that showed the salesmen's id number in the inventory file for the proper product which is linked to the invoice.

What I need is a formula for a field that pays a commission to a particular salesman's ID according to the price that was marked on the invoice for their product.

I was able to set up a field that showed a pre-set percentage in the salesman's file, but it makes the same field for every salesman's file result in the same percentage. I need to be able to set a variable % for each individual salesman to be calculated when their product is sold.

Wow, it gave me a headache just asking this question, I hope there's an easy answer.



Link to comment
Share on other sites

To answer your first question,

People often use these '-' type names to break up a long list of scripts into something more manageable

I think therefore that the script called '-' is possibly just such a script seperator (although you never know) because the '//' at the beginning of any script step means that the script step is disabled (options disable/enable at the bottom of the script editing screen). Do any of the script steps NOT have the '//' at the beginning?


Link to comment
Share on other sites

With regard to your second question,

What you want to do is not difficult at all but it is not clear from your post how often and when you want to use/calculate this information.

For instance do that you want the percentage to be calculated on all the products that a salesman sells in a given period or do you want the figure to be calculated and acted upon (paid?) with every sale of a product.

Does every product attract the same percentage?

I didn't understand the bit about the percentage field that you have setting the same amount for every salesman. Either the field you have defined has been nominated for global storage (same value for all records) or the percentage field is not in the salesman table.

Have a think about it, give us a few more clues and this one is an easy one to sort



Link to comment
Share on other sites

Hi Phil,

Thanks for your interest. I used to think I was pretty smart until I starting using filemaker, so you scare me when you say it's easy.

I used my one time support code to call them about this and the tech assured me it was easy also but he couldn't tell me how to do it. He said the extent of his support was things like installing the program or how to register it, at least I know as much as he does.

You were absolutely right that when I first made the fields I marked them as global to get them to work, and it actually did with using only one field entry.

Now I see how my setup would never work with multiple salesmen.

I'm using two tables, one is the salesman's database and the other is inventory.

I enter John as the first salesman with an id number of 6830, his "commission rate" field is marked 20%

Mary is the second salesman with an id number of 6840 and her commission is 25%

now that I have turned off the global storage in the commission field ,their rates are as unique as their phone #'s

Switching to Invoice I add a product including the salesman's ID#, and the price from the inventory table for each product.

What I need to do now is a field that shows the commission for the salesman's product.

sample invoice

(1) (name of product 1) (6840) (price)

(1) (name of product 2) (6830) (price)




the only formula I have so far is:

new field = Round ( Price * Salesman::commission Rate;2 )

This is from the inventory table, commission Rate is a field(with the pre-inserted%) in the table named Salesman.

Hopefully, I can use the final field to add to a running report for tracking each person's sales and so on, which I can probably figure out once I get through this.

Oh yeah, I almost forgot about the original post.


Now I see on the bottom where you said to toggle the disable after you enter the step. but everything in this whole script is // and it's the only reference I can find for the prefilled data fields.

somewhere in the database there must be a call to enable it but how do I find it? I thought I looked through every script and every field and even used the debugger to the open scripts, but the fields are all prefilled with the data when it opens.

Link to comment
Share on other sites

somewhere in the database there must be a call to enable it but how do I find it? I thought I looked through every script and every field and even used the debugger to the open scripts,

If every line of the script is disabled then it won't even run. If it will run from ANYWHERE then it will run directly from ScriptMaker. So, on a backup copy, select the script and click 'Perform.' Have debugger on then you can see what it does, ie, watch it switch layouts and do it's thing. But if ALL lines are disabled it won't do anything. You can't enable script lines from another script.

I suspect it is just a development tool. I have a script at the top of ScriptMaker (for quick access) which I reuse for temp scripting and testing. If any Users have access to ScriptMaker or its Ctrl-0-9 then I make sure all lines are disabled before I turn it loose. But I leave my 'thinking' there for next time.

Link to comment
Share on other sites

Deskmate is saying that a Name field is being filled in and the only place he can find a statement to cause this is in that disabled script. So where is it happening?


Historic? I don't think so.

Auto-enter? Check your field definitions.

Some other script? (I know you've searched them all. How often? It's the tenth time that counts. Seriously, print all your scripts to a PDF and search the PDF for the field name.) Check if there is a script being executed on Open.

Friendly elves? The best bet.

Link to comment
Share on other sites

Ok, NOW I see what happened. All this time I've been playing with this invoice layout from a copy. I would delete it when I was through and start over. Any time I opened the original, all of the fields were filled in which made me think it was a default. When you mentioned copy, it made me check the original and once I deleted or changed a field, the original data disappeared.

So, I see what the writer did, he hid this script behind a -, ran it once then disabled it and left that data for the first user. What a cool technique, Like a Master Chef that Garnishes the plate with a parsley sprig that will only be tossed away at the first bite. I feel pretty stupid now but at least I learned a new technique and where the diab le button is.

Link to comment
Share on other sites

but, what about the "easy" stuff?

When I place a price in the price field of the inventory table, I need it to go back to the individual salesman's table and place their commission from that particular item. I just made a portal that has three fields, date, item, commission. Hoping that it will keep a log every time a new product is entered into inventory. The price field would be the result of the price entered in the inventory table multiplied by the percentage that is from each salesman's field.


John's file has an id field for 6830 and another for 20%

Mary's file has 6840 and 25%

The inventory table has a list like ;)

product 1 reserved for 6830 at $100 and product 2 entered for 6840 at $300

Link to comment
Share on other sites

The price field would be the result of the price entered in the inventory table multiplied by the percentage that is from each salesman's field.

I meant to write the NEW FIELD would be the result of the price entered in the inventory table multiplied by the percentage that is from each salesman's field.

Link to comment
Share on other sites

Hi Deskmate

It really is very simple to do this using a calc field.

Somewhere in one of your tables you will need to have a record with the item price and in the same record the salesman's ID. One field for each, one record for each item sold.

You will also need another table that has the salesmans id and his rate of commission. Again one field for each, one record per salesman.

If you create a relationship between these 2 table s based on salesman id = salesman id then in the first table you can create a calc field with the following formula

Item price*yourrelationship::rate of comm/100.

When you enter the price of the item into the record this field will then calculate the commission on that item at the current rate for that salesman.

That is how easy it is to do but it is not necessarily the best way to do it.

Because I am not familiar with your current structure nor procedures it is hard for me to advise but you might not even need to have this calc field.

You could for instance not need to store the actual commission per item you could instead use a script.

Assuming that the first table had a date field in there as well you could do a find on a certain salesperson for say January, calculate the total sales for that month and then calculate a gross figure for the commission via the script. That is just one other possible method.

It really is up to you to decide exactly what you (or better still the user) want.

I hope that gives you a little food for thought. Let me know if you need any more help.



Edited by Guest
Link to comment
Share on other sites

Hi Phil,

I'm still having trouble understanding. If you look at post #231341 I think I have the tables your are talking about, are you saying I need a third table?

I'm not exactly sure in your calc

Item price*yourrelationship::r ate of comm/100.

would "yourrelationship" be the same as 6830 or 6840 in my example in post 231341 ?

and I don't understand the slash 100

Did you hear the one about the old couple traveling in kissimee Florida that couldn't decide whether it was pronounced kiss IM mee or KISS imee so they stopped for lunch and the old man asked can you tell me exactly where we are and explain it very slowly so we can understand it? and the clerk said

B - U - R - G - E - R -- K - I - N - G

Link to comment
Share on other sites

maybe if I just focused on one at first

salesman's table= fields for john:

name address, etc including a field named

sales id (6830)

and a field named

commission rate 20%

inventory table=

fields for item:

product,quanity ect

including the field FROM SALESMAN"S TABLE


and the field from current table(inventory)

price= ($99)

Link to comment
Share on other sites

Hello Phil

I really appreciate the time you're taking.

You're right, your formula works and it is surprisingly simple. If you would see all the scripts and complicated things I've done so far you would laugh to death.Each time it wouldn't work, I would add more scripts and calcs.

However, it still doesn't work with my setup.

Yours is one file with two tables. What I have is one file for inventory and another for salesmen each with their own table.

I have one "define file references" in the inventory table that has the salesmen's table added. I made the calculation field as in your example and it worked fine for each inventory item assigned to the correct salesman just as I wanted, but the portal in the salesmen's table did not.

The define database was not set like yours with the two separate tables listed in each.

When I tried to add the salesmen's table to the "define database" I got an error and it made a new table "salesmen 2"

I deleted the salesmen table in the "define file reference" and I added the salesmen table again in the "define database". Also added the inventory table in the salesmen's "define database".

Now it all looks like your example but nothing works. What am I missing?

I attached my example in case I didn't describe it correctly


Link to comment
Share on other sites

This topic is 5774 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

  • Create New...

Important Information

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