Alpha Video Training
Results 1 to 8 of 8

Thread: How do I store a user and populate a date field upon an update/insert via my web app?

  1. #1
    Member
    Real Name
    Josh Cole
    Join Date
    Nov 2009
    Posts
    296

    Default How do I store a user and populate a date field upon an update/insert via my web app?

    I want to be able to store the UserID of the person editing/updating records as well as populate a date into my CompleteDate field when the Complete checkbox is ticked. Any help is greatly appreciated.

  2. #2
    "Certified" Alphaholic chadbrown's Avatar
    Real Name
    Chad Brown
    Join Date
    Aug 2007
    Location
    Aurora, Ontario, Canada
    Posts
    1,408

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    If you are using sql you can set up a field for datetime and use now() or curdate() to set a timestamp for the update alternately mysql you can have a field that is a timestamp field and on update it will automatically set the updated timestamp.
    As for the grid
    Add a field(s) like updated_by and time_stamp to your table and then add them to your grid hide the column(s) and change the type(s)to hidden.

    Then in the can update event you can do

    DataSubmitted.updated_by= session.__protected__userid
    DataSubmitted.time_stamp= now() or curdate() ---for just date

    Hopefully this will help.
    Chad Brown

  3. #3
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    Quote Originally Posted by chadbrown View Post
    Then in the can update event you can do

    DataSubmitted.updated_by= session.__protected__userid

    Hopefully this will help.
    Thank's Chad, I was just about ready to conquer this myself and it's already solved. Do you happen to know the data type and size of session.__protected__userid?

  4. #4
    "Certified" Alphaholic chadbrown's Avatar
    Real Name
    Chad Brown
    Join Date
    Aug 2007
    Location
    Aurora, Ontario, Canada
    Posts
    1,408

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    that all depends on your security settings but i beleive it is always character but i am not positive on that.
    Chad Brown

  5. #5
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    I thought I had it solved.... where does 'session.__protected__userid' come from? Do I creates this or is it a built in alpha variable? when I try to use it I get an error stating that it does not exist.

  6. #6
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    I was able to search the forum and find out how to assign the Userid to session.__protected__userid.

    When I try to assign the session.__protected__userid to my lastuid field in the CanUpdateRecord Event I get this error


    Error executing CanUpdateRecord event handler: command: DataSubmitted.lastuid = session.__protected__userid Not found
    session not found.

    I can see that the session.__protected__userid has a value by using ? session.__protected__userid in the a5w page.

    What gives?
    Last edited by frankbicknell; 03-30-2010 at 10:54 AM.

  7. #7
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    I just learned that you have to put the session variable reference within the 'WITH PageVariables - END WITH' declaration.

    I thought that session and page variables are different.

    New issue. I can no longer run in working preview without an error due to the session variable not found.
    Is there a way around this?

  8. #8
    "Certified" Alphaholic chadbrown's Avatar
    Real Name
    Chad Brown
    Join Date
    Aug 2007
    Location
    Aurora, Ontario, Canada
    Posts
    1,408

    Default Re: How do I store a user and populate a date field upon an update/insert via my web

    session variables will not work in preview as you have not signed into the system they will only work in a live environment.
    Chad Brown

Similar Threads

  1. "Store locator" in web app server page
    By Bill Warner in forum Application Server Version 8
    Replies: 4
    Last Post: 06-11-2008, 10:20 AM
  2. single user RT- update user app databases
    By Wesolson in forum Alpha Five Version 8
    Replies: 1
    Last Post: 10-04-2007, 10:36 PM
  3. digital photo store web app
    By Bob Arbuthnot in forum Application Server Version 8
    Replies: 0
    Last Post: 06-21-2007, 01:13 PM
  4. field to store web page link & to store doc pa
    By John Castle in forum Alpha Five Version 5
    Replies: 8
    Last Post: 05-18-2004, 07:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •