Jump to content

Script to auto create a line-item?


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

Recommended Posts

I have invoice and line-item databases related. To print the invoice, I was advised to create the printed invoice layout in the line-item db (header contains invoice fields, body contains line-item fields, summary contains totals). That seems to work, but I noticed invoices do not print if there are no related line-items on the invoice. An acceptable work-around for this would be to automatically create the first line-item when a new invoice is created.

How do I create a new line item record from script, whenever a new invoice record is created? I only want to fill-in one field in the new line item record from the script.

Also how could I script the invoice db to always go to the last record, when the file is opened?

Link to comment
Share on other sites

quote:

Originally posted by kmaiden:

...invoices do not print if there are no related line-items on the invoice.

Why print invoices that have no line items?

quote:

How do I create a new line item record from script, whenever a new invoice record is created? I only want to fill-in one field in the new line item record from the script.

Run a script in your lineitem db which creates a new record and sets the invoice IDs, or use the SetField step and set a value in a field in the lineitem db, this will automatically create a record if none exists.

quote:

Also how could I script the invoice db to always go to the last

record, when the file is opened?

Create a startup script with contains the command GotoRecord[Last]

Link to comment
Share on other sites

Thanks CaptKurt. I set a start script to go to last, that works. But could you give me a step-by-step of how to code a 'create new line-item'? I have a new button in the header on the invoice layout. I don't understand where to put the script steps.

A: Run a script in your lineitem db which creates a new record and sets the invoice IDs, or

B: use the SetField step and set a value in a field in the lineitem db, this will automatically create a record if none exists.

I'm new and only have the FMP 5.5 trial version. Thanks Capt.

Link to comment
Share on other sites

I cannot really give too detailed a step by step if you do know have the knowledge/experience to understand what I am talking about.

I would suggest starting with a book or two on Filemaker Pro and/or relational database design.

You need to understand how relationships work and what the various options for them are, you also need to understand portals as well as how scripting works.

I am sure that you are close to understanding, but you need a bit more general understanding so that you can both ask the right questions and understand some of the more advanced answers.

goto http://www.fmforums.com/ubb/cgi-bin/ultimatebb.cgi?ubb=forum&f=44&DaysPrune=1000&SUBMIT=Go for more information about learning resources.

Link to comment
Share on other sites

Sorry if I gave the wrong impression. I'm NOT a new developer (professional since '83). New to FMP (very well versed in relational DB concepts, Computer Science Degree, MS Access, VB, SQL, etc.). I've read many of the forums here and on Cafe, and pick up quickly.

I'm actually using the trial version for a 'proof of concept conversion' which is 89% complete in 2-weeks (took 2 months in Access). I'm trying to make sure FMP can actually replace Access on this application.

Hit me with your advanced stuff and let me sink-or-swim! I really appreciate your help, thanks.

Link to comment
Share on other sites

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