Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Product ID Incremental Based on Product Type

Featured Replies

  • Newbies

I have serveral product lines (ex: shoes, shirts, and pants). Each product line has its own product number series, shoes are the 1000 series (with id numbers being 1001, 1002, 1003...), shirts are the 3000 series (with id numbers being 3001, 3002, 3003...) and the other product lines follow suit.

When I create a new record I want FileMaker to automagically generate the next product id that is applicable when I select the product type from a drop down box.

In the backgound FileMaker should be doing something that I guess it would look like this:

Look at the PRODTYPE field and see that it is "Shoes"

Find the highest PRODTID where the PRODTYPE is also "Shoes"

Add 1 to that PRODID and place it in the one for the new record.

So therefore if I selected Shoes as the type but already has 2 records for shoes, filemaker would recognize 1002 as the highest number associated with the product type shoes and add 1 to give me 1003.

How can I go about doing this?

Hi shanksta,

There is a perfect example of this on the NightWing website. It's:

Independently Incrementing Serial Numbers

The demo uses Clients IDs combined with serial numbers but can be used for Product Type as well. smile.gif

Cheers,

LaRetta

  • Author
  • Newbies

Thanks that was a great link.

Im kind of new to FM, so I really dont know how to convert that example into something I can use.

As you said the client IDs are combined in the serial. I am looking at how to have those incremental serials based on ID - just like that example, which I kind of underdstand. However is there a way to make that ID part of the series I posted about?

Meaning if I used that as is, I would have "SHOES-0001" as a product ID, where I would rather have FileMaker see shoes immediately add the series to it.

After some thougt I see that the unique ids are good to implement, so now I have ID 1 for SHOES, but how can I add 1000 to that based on the product type. I think it would be easier to tell FileMaker to add 3000 to the id whenever it sees "SHIRTS: - but how do I do that?

looking at the sample file from above...any time u enter in ClientID (or for you "product name" being shoes,pants etc. ) you will generate what you need

shoes-001

just make a value list(custom) for the ClientID (esentially Product_Name for u) that will hold the names....

http://mostarnet.com/CustomSerial.zip

same file a bit edited.....

All the best!

  • Author
  • Newbies

Thanks Leb -

Right now I basically have it so that there is now "pants" or "shoes" designation just a number that is incremental based on the product type.

I want to just add one CRUCIAL thing - add 1000, 3000, or 5000 based on the product type. This basically means that instead of starting at 1 for shoes I want to start at 1000, instead of 1 for pants I want to start at 3000, and so on...

How to I get different product types to start at different numbers? Or, if its easier, how can I add 1000, 3000, or 5000 (based on the product ID) after the serial has been generated.

look into Define Fields....and see that "000" is taken as a starting point that can be changed to 1000......perhpas a script with an IF statement...I will have to look into it if get the time.....perhaps more expereienced users will join...

until then

All the best!

  • Author
  • Newbies

Im playing around with that "000" right now.

smile.gif

Hello Shanksta,

Rather than playing around with the '000', you would be better off looking at having the starting reference range defined in a calculated prefix field which picks up the type field (the equivalent of the clientID field in the demo referred to above) and appends the apropriate starting range number. Eg:

Case(ProductType = "Shoes", "SHOES-1", ProductType = "Pants", "PANTS-2", ProductType = "Hats", "HATS-3")

Which you then reference your calculation in the serial number calc, viz:

YourCalc & "-" & Right("000" & serial, Max(3, Length(serial)))

You will end up with a final string that looks like SHOES-1001, SHOES-1002 or PANTS-2007 etc - which is what I gather you are after?! smirk.gif

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.