This topic is locked

fill in values of certain fields based on current user

7/13/2007 3:27:04 PM
ASPRunnerPro General questions
C
chris author

ASPRunner 5.0 build 275

Oracle 10g

I have a table that I am trying to populate certain fields based on the current user(username or UserID) during an add.

What sample code could I use and where do I put it in events?

The table name is Incident

The table being referenced is userdb that has two fields: super_email and phone that I would like to populate upon load but allow the user to change if necessary.

Thanks for your help.

Chris.

Sergey Kornilov admin 7/16/2007

This is a two-steps process

  1. Use AfterSucessfulLogin event to store user details in session variables
  2. Use these session variables as Default values.

C
chris author 7/19/2007

This is a two-steps process


  1. Use AfterSucessfulLogin event to store user details in session variables
  2. Use these session variables as Default values.


I have created the session variables and put them in as default values, but they are still not filled in.

These values are currently stored in the user table under the username. How would it know what they are unless it looks them up? I am missing something here, should I do a Join query or something like that?

I have tried to use the strTemp lookup and can't seem to get the right combination to get these values.
Chris.

J
Jane 7/20/2007

Chris,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

C
chris author 7/24/2007

Chris,

it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.



Sorry it has taken so long to reply back, I will have to send it via email, because it is an oracle database that I am connecting to, so I am not sure I can publish it to your demo account. If I am wrong, please let me know.

Thanks,

Chris.

PS. In the past I created scripts and sent you the project file and scripts so that you can recreate on your system.

B
Bryan 7/25/2007

Hi there,
Similar to this, I need to automatically populate the "Added By" and "Date" fields in my table when someone adds a new record.
The fields should be read-only.
Could anyone provide some code of how to store the UserID and Date and populate the fields?
Many thanks in advance,

Bryan

B
Bryan 7/25/2007

Hi,
Further to this, the date is helpfully displayed in the Field Properties screen so that's great.
I do have another problem however:
My table has the following structure:
Title (Text)

Desc (Text)

Date (Date)

Added by (Text)
For some reason, the Default Value for title was the UserID (very handy, as I was asking for that code in my post above).
I have no idea where this code came from.
I have taken this default value out however everytime I now add a new record and put a value in the Title field, the value is always set to the UserID when it returns to the List Page.
Any thoughts?

B
Bryan 7/25/2007

Please ignore all this - my fault, due to setting on the login screen.
Thanks