Skip 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.

generate ItemID

Featured Replies

Hello People!

Perhaps this sould be under scripts but I have feeling that right definition of fields might do it.

Here is what I have so far:

Fields:

VendorID

ItemTypeID

CatID

Prefix_ItemID= VendorID&""&ItemTypeID&""&CatID

No_ItemID = autoenter serial 1...1

ItemID =Prefix_ItemID&""&No_ItemID

This approach works only for the 1st item

eg. ItemID = "ABC1" and ONLY IF I want to create another item made by the same A B C (vendor,item type,category) will correctly increment by 1.

How do I get arround the fact that I might be creating itemID "CCC1" many records later?

Thank you for the help!

Create Prefix_ItemID just as you have it. Then create a self-join relationship called Prefix so that Prefix_ItemID = Prefix_ItemID. Then create an auto-enter calc field called CountPrefix= Count(Prefix::Prefix_ItemID). ItemID will then be Prefix_ItemID & "_" & If(CountPrefix="",1,CountPrefix+1).

That should do it. The sticky bit is that CountPrefix will be empty the first time you create a Prefix_ItemID. So in Item ID its corrected with the If statement and the addition of 1.

Dan

Well, make sure you never delete a record then.

ABC1

abc2

ABC3

ABC4

Then, delete ABC2

Next creation will be ABC4 leading to a duplicate

IMO, this approach is bug sensitive.

  • Author

Great!

Thanx Dan!

I had a feeling that some "find prevois" or "count" might be involved. Pretty slick!

One quick question:

Since this is ItemID= Unstored,Text and can not be indexed nor validated do you suggest I creat a "Temp_ItemID" and then copy-paste it so I can index it, or is this an overkill?

Thanx!

You'd need to work on the serial and have it lookup the next one by the SelfJoin.

c_Compound = Item&Category&...

SelfJoinOnCompound = c_Compound::c_Compound

Serial= AutoEnter Number (increment) - Lookup from NextSerial by SelfJoinOnCompound - define it to return 1 if not found.

NextSerial = Max(;):SelfJoinOnCompound:Serial)+1

So that the ID is autoentered as Compound&Serial and preferably Compound&Right("0000&&serial,4) to have a workable text ID

  • Author

Hi Ugo!

WHERE oh WHERE smile.gif do u get this stuff.....works like a charm!

the most crutial was "Serial" field....briliant!

Much Obliged!

Arrgh! I defer to you sir, you are the master. I hadn't thought of the deletion problem. Nicely done.

Dan

Guys,

I didn't have an epiphany with this one. This is a known "tip", which I first get from Bob on these Forums, and recently found Ray had a sample for this on his site.

Thanks though.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.