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.

Autoincrement a field

Featured Replies

Hi,

I would like to have a calculated field (count field) in a table which increments automatically if a user (user field) enters a record. So some sample data might look like the following:

User, count, other stuff

------------------------

JOE, 1, otherStuff

JOE, 2, otherstuff

JOE, 3, otherstuff

SALLY, 1, otherstuff

The next time JOE creates a new record I would like the count to be automatically set to 4. If a new user, FRANK, enters a new record, I would like it to automatically default to 1.

Regards,

Zenon

What if Joe deletes a record (that he didn't create)? I'm too tired to think of other gotcha's, but I would imagine that your requirement might be solved in a more direct way if we knew why you felt that you needed this incrementing field. Could you elaborate on the business requirement?

  • Author

Hi,

The requirement is that each user identifies each record (in our case a slide) with an identifier, unique for the user (the combination of user and count is unique). I can make the "count" field user entry, but it would be better for the user if the field was populated automatically.

I don't really care if a user deletes a record, as long as the "cont" field is unique for the user.

Thanks,

Zenon

Why? To what purpose must a user identify each record?

My thoughts:

1. You're looking to establish some sort of security model whereby a user is only able to view "his" records.

2. You're tallying the number of records a user has created. By the way, you don't mention a User table or the fact that you might be populating records with an auto-enter gUserID.

3. You aren't aware of auto-enter increment serial numbers.

4. You're merging data from several off-line files.

So, please tell me your goal, because describing a technique in the dark, so to speak, might do you a disservice.

hth,

Barbara

  • Author

Sure, I'll try to explain... I'm very new to FM more familiar with other db - trying to learn.

[color:green]My responses are green

1. You're looking to establish some sort of security model whereby a user is only able to view "his" records.

[color:green]Yes, most of the time users only want to view their own records. Occasionally they will need to view all records or a list of records other users records

2. You're tallying the number of records a user has created. By the way, you don't mention a User table or the fact that you might be populating records with an auto-enter gUserID.

[color:green]Yes again, we would be auto-populating the user with the userId.

3. You aren't aware of auto-enter increment serial numbers.

[color:green]Well, I thought that the increments are general and not user specific. Can you create a increment that is user specific( without creating a separate increment for each user). We do want an increment as the primary key, but also want a way to segregate the data by user

4. You're merging data from several off-line files.

[color:green]No, the users are putting in their info manually

Regards,

Zenon

You really didn't answer my question. Why must you have this user-specific incrementing count?

  • Author

Well, I don't really need to have this field auto populated. We could let the users enter in a unique identifier for each user/slide combo. I thought that there may be an easy way to automatically do this as a convienience for the users. If not, we can use the workaround.

Thanks,

Zenon

I'll stop asking why this is needed since you don't seem to want to explore the goal of this requirement.

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.