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

Next entry script


Darren Walker
 Share

Recommended Posts

Hi,

 

Im trying to write a script that will allow me to add records to a purchase order database, on a button click from a stock database.

There are two fields that I need to work on.

The Item Description and the Stock Code.

I want to select an item of stock with a button and add it to the purchase order database, then select a second item and add it to the next line of the database and so on upto a max of 20 items.

What I need to work out is a loop.

It is something like:

if Item Description is empty then put the info in this line if not then put it in the next line. I then need it to do a look up from the stock database.

 

Any ideas???

 

Cheers folks

Link to comment
Share on other sites

Darren,

 

I take it you are using a related line items database (and not a repeating field.)

 

Do you always select 20 items, or just upto a max of 20 items.

 

If upto a max of 20 items,

 

you may want to add a counter field.

 

Then you can check this by adding into the top of the script.

 

If counter = 20

Exit script

End If

 

Then you don't have to stick in a loop.

 

The act of adding the stock code to the new record can be done via the script too. The line items file has the stock code and the description fields (along with others).

 

The description is a lookup basd on a relationship from stock code to stock code.

 

HTH

Link to comment
Share on other sites

Sorry to be a pain, but it is a repeating field, I am relatively new to it all, and didnt know any different. I used the example Purchase order db off the filemaker site, and then created the other db's to fit around it.

We only select one item at a time, there is a maximum of 20 repetitions, and rarely do we order more than 10 items ( 20 was just in case).

I created an items db for the customer and it uses fields related to the stock db. So the idea was the we go to the customer db, select the item that they want and it gets added to the purchase order.

 

cheers

 

darren

Link to comment
Share on other sites

Darren,

 

Repeating fields will get you into trouble further down the road. It would be better to seperate them out now into a line items database.

 

This involves creating a database that has the repeating field information in it. These repeating fields become their own records then. You then include a way of identifying these records back to the main database, which is usually the invoice number (a serial number).

 

So, you would create a new database (say called line items)

 

In this you would have fields for

 

purchase order number (this is going to be the key field)

Line item number (this is an auto enter number)

Stock Code (a text field)

Description (a text field with a lookup option, using a relationship from the stock code::stock code field in the stock database that will lookup the stock description)

Price (also a lookup using the stock code relationship)

 

Now, from your purchase database, create a relationship from the purchase order serial number field (which I am assuming you have) to the purchase order number in the line items file.

 

This has now removed the repeating fields that you did have, and given you a relational purchase database. Trust me when I say this is a good thing.

 

You can then if you still require it, work out your maximum items, but it will become a hell of a lot easier now than when you had repeating fields.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use