NetTalk Central

Author Topic: NetWebForm PostGreSQL value of auto incremented column?  (Read 4106 times)

Johan van Zyl

  • Full Member
  • ***
  • Posts: 180
  • jvz
    • View Profile
    • Email
NetWebForm PostGreSQL value of auto incremented column?
« on: October 10, 2014, 12:17:48 PM »
PostGreSQL

I need two values:

table: brandnames
In PostInsert I have this code
 Access:auditlogheader.PrimeRecord()
    alh:logtimestamp_DATE = Today()
    alh:logtimestamp_TIME = Clock()
    alh:username = p_web.GSV('usr:userlogin') ! does not work
    alh:tablename = 'brandnames'
    alh:keyname = 'bra:brandnames_pkey'
   alh:keyvalue = bra:brandnamesysid
OR?
    alh:keyvalue = p_web.GSV('bra:brandnamesysid')
does not work

In PostUpdate  alh:keyvalue = bra:brandnamesysid works just fine

How do I obtain the value bra:brandnamesysid that has has just been created by the PostGreSQL sequence.
How do I obtain the username from a normal login form?
Johan van Zyl
Clarion 6.3 9058/C8 Gold/SQL/NetTalk WebServer

Johan van Zyl

  • Full Member
  • ***
  • Posts: 180
  • jvz
    • View Profile
    • Email
Re: NetWebForm PostGreSQL value of auto incremented column?
« Reply #1 on: October 10, 2014, 01:20:39 PM »
I have now added this to PostInsert
p_web.FileToSessionQueue(brandnames)

but this still does not work
 alh:keyvalue = clip(p_web.GSV('bra:brandnamesysid'))
Johan van Zyl
Clarion 6.3 9058/C8 Gold/SQL/NetTalk WebServer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebForm PostGreSQL value of auto incremented column?
« Reply #2 on: October 20, 2014, 02:30:39 AM »
>> How do I obtain the value bra:brandnamesysid that has has just been created by the PostGreSQL sequence.

This is a PostGres question, not a NetTalk Question. ie you do it the same way you would for a normal clarion / Postgres program.

>> How do I obtain the username from a normal login form?

In the login form you write the username into a session value, which you can then retrieve later on. ie just save the value, in the form, into a session value of your own name. (don't use a File-field name.)

cheers
Bruce

Johan van Zyl

  • Full Member
  • ***
  • Posts: 180
  • jvz
    • View Profile
    • Email
Re: NetWebForm PostGreSQL value of auto incremented column?
« Reply #3 on: October 21, 2014, 12:59:51 PM »
>> How do I obtain the value bra:brandnamesysid that has has just been created by the PostGreSQL sequence.

This is a PostGres question, not a NetTalk Question. ie you do it the same way you would for a normal clarion / Postgres program.



After inserting a Brandname in UpdateBrandnames NetWebForm I cannot "see" bra:brandnamesysid whether I put the code in PostInsert or ValidateInsert. Seems there is a difference between ABC and NTWS. I need the value to create audit log files
Johan van Zyl
Clarion 6.3 9058/C8 Gold/SQL/NetTalk WebServer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebForm PostGreSQL value of auto incremented column?
« Reply #4 on: October 21, 2014, 11:20:23 PM »
There are certainly lots of differences between ABC and NTWS. However the file management uses ABC so that should be the same.

ValidateInsert occurs before the record is written, so that's probably not helpful to you.
I would expect whatever to be set by PostInsert though. But I don't know PostGres so you may have to trace what is actually happening -

The Insert itself is done via the SaveForm method, which calls the AddFile method - which in turn calls the file manager (see the code in WebHandler, AddFile method.)

cheers
Bruce