NetTalk Central

Author Topic: how to implement autoincrement in update form afterwords  (Read 4124 times)

joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
how to implement autoincrement in update form afterwords
« on: May 23, 2014, 01:58:14 AM »
Hi All

I have generated an webapplication with several browses and forms.
In the database (sql server) I have several key's with an identity.
But I haven't got auto increments on those key's in the dictionary.
Unfortunally, implementing these increments in the dct, generates no extra code by the templates.

I tried to implement the code by myself but it doesn't work. (form is not primed)

code I used at the preinsert and precopy:

 ! Start of "Pre Insert After Primes"
 ! [Priority 5000]
 p_web.PrimeFile(Smp_Algemeen,true,0)
 Ans = Net:ChangeRecord
 p_web.SetSessionValue('UpdateSmp_Algemeen:Primed',1) 
 ! End of "Pre Insert After Primes"

What am I doing wrong?

Regards,
Joep

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: how to implement autoincrement in update form afterwords
« Reply #1 on: May 23, 2014, 04:16:33 AM »
Hi Joep,

I'm not sure I understand the problem. You've documented a solution (which doesn't work) but I'm not understanding the exact problem you are trying to solve. Can you elaborate a bit?

cheers
Bruce

joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
Re: how to implement autoincrement in update form afterwords
« Reply #2 on: May 23, 2014, 04:31:08 AM »
Hi Bruce,

The problem is that I cannot insert a child record upon the insert of the parent.
I get an error that the parent has no id yet.
I suppose that problem is due to the fact that we generated the forms with no auto increment in de DCT.
Now I have set several auto increments in the dictionary.
But the code is not changed by these settings in the dictionary.

And the parent is still not primed, so I keep getting an error that there is no id.

I thought I could paste the nescessary priming code by hand, so the form would get primed.

Regards,
Joep


joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
Re: how to implement autoincrement in update form afterwords
« Reply #3 on: May 26, 2014, 02:08:07 AM »
Hi Bruce,

Actually it's a bit different now.
The record is primed now and I can see the parent id in the form,
but the child is still complaining that there is no parent id.
All I have done is setting the auto increment in the dct on a few key's.

Regards,
Joep

joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
Re: how to implement autoincrement in update form afterwords
« Reply #4 on: May 26, 2014, 02:54:06 AM »
Hi Bruce,

I changed the foreign key's on the sql server database and now it works.

Regards,
Joep

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: how to implement autoincrement in update form afterwords
« Reply #5 on: May 26, 2014, 03:33:11 PM »
Hi Joep,

there are some auto-increment options on the last tab of the form template that may have helped you without adding the auto-increment to the dict.