Home » Developer & Programmer » Forms » How can I populate a field with the current user (Forms Builder 10g)
How can I populate a field with the current user (Forms Builder 10g) [message #87245] Wed, 15 December 2004 09:02 Go to next message
MichaelChang
Messages: 7
Registered: December 2004
Junior Member
Hi everyone,

   I'm brand new to Oracle.  I'm using the Oracle Forms Builder and I'm trying to set the "Initial Value" (in the Property Palette) for the "User" (text) field to autopopulate the currently logged in user.

   For my "Date Created" field I used $$DATE$$ and it works great but $$USER$$ and $$SYSUSER$$ don't work.

  Any ideas?

 

TIA,

 

-MC
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87246 is a reply to message #87245] Wed, 15 December 2004 10:44 Go to previous messageGo to next message
Just John
Messages: 69
Registered: November 2004
Member
the $$constent$$ doesn't hold many options, its good for dates and static values but not much else (in my view)

create a trigger, i.e. WHEN_NEW_ITEM_INSTANCE trigger

:block.item := USER;
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87249 is a reply to message #87246] Wed, 15 December 2004 11:04 Go to previous messageGo to next message
MichaelChang
Messages: 7
Registered: December 2004
Junior Member
Hey, thanks for the response but that didn't work :-(

"I get the error 'bad bind variable 'block.item'"

I tried this trigger in the form itself as well as in the item, same error,

any ideas?

Thanks,

-MC
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87250 is a reply to message #87249] Wed, 15 December 2004 12:54 Go to previous messageGo to next message
Just John
Messages: 69
Registered: November 2004
Member
replace :block.item for the actual block and item name

e.g.

:emp.ename for block 'emp' data item 'ename'
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87251 is a reply to message #87249] Wed, 15 December 2004 12:57 Go to previous messageGo to next message
Just John
Messages: 69
Registered: November 2004
Member
If the when_new_item_instance trigger doesn't work as expected also try WHEN_NEW_RECORD_INSTANCE

The W_N_I_I trigger should be placed on the data item, while the w_n_r_i_ should be on the actual block.
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87281 is a reply to message #87250] Thu, 16 December 2004 06:26 Go to previous messageGo to next message
MichaelChang
Messages: 7
Registered: December 2004
Junior Member
Hey thanks,
What worked for me is placing the WHEN_NEW_RECORD_INSTANCE trigger in the data block.

On a separate note, I'm trying to place a file upload control on the form so a user can click the button, browse their hard drive, select a file, and have it placed in the field (or item). In this case, the item references a field in the table that is a BLOB.

Can this be done through Forms 10g or would I have to sprinkle in some Javascript into the form in order to make this happen? If so, where/how would I go about inserting the Javascript into an Oracle Form?

I appreciate your help,

-MC
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87283 is a reply to message #87281] Thu, 16 December 2004 06:45 Go to previous messageGo to next message
Just John
Messages: 69
Registered: November 2004
Member
Simple answer yes it can be done :)

technical bits:
you need to downlaod and install the oracle 10g demos (unsure where scan oracle.com - and let me know)
These demos contain example clent server operations one of which is file manipulation.

Then all you need to do is get the file into a blob - Forms should be able to perform that action!

NB: I have heard romours that claim its better to keep these files outside of the database, via external table or similar method (i.e. a table with server size path) then open the file from there.

But who really knows - you could ask Larry - but I don't have is private number! :)
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87317 is a reply to message #87283] Fri, 17 December 2004 07:59 Go to previous messageGo to next message
MichaelChang
Messages: 7
Registered: December 2004
Junior Member
ok so obviously there's no way to integrate html or javascript within Oracle Forms.

I've searched Oracle.com and the internet until I'm crosseyed and could only come up with two options:
- The Oracle Forms File Upload Utility
and
- The WebUtil add on for Oracle Forms

The former requires the use of Java Beans, Java classes, and a PL/SQL library while the latter came with a 64 page user guide that I'll have to dig through to find what I'm looking for.

Granted I'm brand new to Oracle and I certainly hope there's something I'm missing here but coming from the Domino development environment where adding a file upload control to a form takes all of 30 seconds via a point and click menu, I find it hard to believe that one has to jump through all these hoops in order to facilitate this in Oracle Forms?

Does anyone know of a simple way to add a file upload control (enabling a user to browse their hard drive and upload a file to a field in the form) to an Oracle Form?
I also have a Javascript routine that does exactly that, does anyone know how to integrate Javascript code within an Oracle form, sort of like "Pass-thru html"?

I appreciate any tips,

-MC
Re: How can I populate a field with the current user (Forms Builder 10g) [message #87323 is a reply to message #87317] Sat, 18 December 2004 08:29 Go to previous message
Just John
Messages: 69
Registered: November 2004
Member
"ok so obviously there's no way to integrate javascript within Oracle Forms." -- I don't know how true this is......(?) - JDEVELOPER?

but you are correct about WEBUTIL - although there are lots of examples that come with WEBUTIL once it is insatlled. - you don't need to install all of it either (just the bits you are after).

The (not so good) alt: load the directory structure from a text file (i.e. dir >loadme.txt)into the database - then provide the user a way of navigating (perhaps tree view - although I don't the how you would force the heirachary(?)) - I have see silmiar letting users create play lists.

Sorry for the bad news (if you downgrade to 6i (client-server) its all much simpler.
Previous Topic: How to bring a picture for my form to report
Next Topic: FRM-40508 - unable to insert record
Goto Forum:
  


Current Time: Thu Sep 19 13:27:25 CDT 2024