Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hello,

Not sure I have the correct part of the forum. I want to be able to generate a serial number by clicking a button and I'm not sure of the best way to do this.

I tried it by using a separate layout that holds just the primary key and is serialized, but I think there must be another/better way that I'm totally missing. Please help?

Thanks

Dave

Posted

What are you planning on using the serial number for? If you create a new record, then you will get the next serial number. You should use FM's built-in serial numbering system to uniquely ideintify each record.

Posted

John,

What I'm doing is creating all sales records as Quotes with Quotes serialized using FMP serial numbering feature. What I want to do is with the click of a button convert the quote (so to speak) to an official "Invoice" (just adding an invoice number). Currently I have a new record creating both the quote and invoice number (same layout), but thought I'd save the invoice numbers and only generate them when necessary.

Dave

Posted

From your Quotes Table, have a table occurence to the Invoices table keyed on QuoteID, but that has the option for 'Allow Creation or Record Checked' for the Invoices TO. Then in your button, the script would just set the QuoteID using that TO.

If [ IsEmpty (InvoiceCREATE::QuoteID) ]

Set Field [ InvoiceCREATE::QuoteID; Quotes::QuoteID ]

Else

Show Custom Dialog [ "This Quote has already been Invoiced" ]

End If

Posted

John,

I think I can figure this out, but my brain is done for the day. Just to clarify this in case there is any misunderstanding and I'm peeing in the wind.

My setup uses the same table for both the quotes and invoices. Essentially all that is currently happening is "new record" makes a new record generating both a quote and invoice unique id's. I just want the "new record" to generate only the unique quote id and when the sales moves from quote to invoice simply click a button and then an invoice id is added to and displayed in the proper field.

Does this change anything?

Thanks

Dave

Posted

Almost. Basically, you have a quotes table. It stores all the info about a particular quote. Each quote has its own serial number.

Now you are ready to invoice the quote. However, you do not need to duplicate all the data from the quote (including the related data). So there needs to be an invoice table. The invoice table, you will have its own serial number/Invoice number, the QuoteID that gets set with the script and Invoice specific data such as Invoice Date etc.

So, then the above button just sets the QutoeID in the Invoices table. If you 'Allow creation of records' then it will create a new record when the script is run within the invoice table.

Hope that this clears it up.

Posted

John,

Is there a reason I can't keep them in the same table and just add the invoice number?

You mention about a script in your last post and it seems like an additional script to the button, are you referring to another script that needs to be written?

Sorry, I'm getting a little lost on this now.

Thanks

Dave

Posted

John,

Could I bug you about something?

I got your sample and have most of it working, but for some reason when I click the "invoice me" button is doesn't move it to the invoices tab, but it does make a new invoice # in the invoices layout. I have the tabs you showed me built into my customers layout. You have any idea why it might be generating the invoice number but not copying the quote to invoices?

This probably isn't enough information. Sorry.

Thanks

Dave

Posted

Without seeing your file, I am not sure where the issue could be. Did you try adding a refresh step?

Posted

Dave, you do not have your foreign key for your customerID in the invoices table set. Take a look at the Auto-Entry options in the field within the sample I posted to correct your changes.

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