NetTalk Central

Author Topic: Autoincrementing Part II  (Read 4658 times)

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Autoincrementing Part II
« on: October 31, 2007, 01:33:34 PM »
I'm terribly sorry to keep asking, but I think I missed your point about autoincrementing numbers, and it's the only thing keeping me from beta testing my own new app.

In example 31 of the Webserver, the customer, invoice, and product IDs all look to have the PrimeAutoInc checkbox marked. The unlike the customer and invoice incrementing, the product numbers show '0' on the update form. I can see no difference between how these records work. I'm wondering if it might be a glitch.

Or, I may be misunderstanding what you're saying about parent / child IDs incrementing. I suspect it's either a bug or I'm missing a check box. I do have PrimeAutoInc() checked on the advanced tab, but it still displays 0 on the form. Thanks! MikeG
Mike Grigsby
Credify Systems
Central Oregon, USA

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Autoincrementing Part II
« Reply #1 on: October 31, 2007, 10:17:59 PM »
Sorry Mike, I was following up on your earlier thread yesterday, but got a bit side-tracked.

I've refreshed my memory (by looking at the code) and have discovered that the Prime Auto Inc setting wasn't quite what I had in mind.

Rather than forcing the Auto-Inc behavior ON, it allows you to force it OFF.

It is off by default, but is automatically turned on if there are Browse children of the form.

Remember this is preferred behavior because the standard way of doing auto-incrementing (Insert, then Update) is not ideal in a web situation.

If you wish to force the Insert to occur up front (which I don't really recommend) then I'd need to add a template witch to do this, or alternatively you can add the following code to the PreInsert routine in your app;

  Access:%FormFile.PrimeRecord()
  Ans = ChangeRecord
  p_web.SetSessionValue('%Procedure:Primed',1)

replace %FormFile with the file label, and %Procedure with the name of the procedure.

A better approach might be to simply hide the "Code" field when the form is in Insert mode. Do this by setting the "Include Condition" of the field to

loc:act <> InsertRecord

Cheers
Bruce

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Autoincrementing Part II
« Reply #2 on: November 01, 2007, 09:55:23 AM »
Your genious scares me!<g> Perfect. Thanks Bruce! MikeG
Mike Grigsby
Credify Systems
Central Oregon, USA