[comp.databases] sqlforms: creating display-only blocks

cm@yarra.oz.au (Charles Meo) (09/10/89)

To all Oracle forms gurus:
I am currently working on a product admin system for a client, and while
the definition of forms for database tables is not much of a problem, I'm
damned if I can see how to do a simple thing like create a nice header
containing just the current username and the date up the top.

I have tried:
- defining a separate block called HEADER, with two non-database fields
called u_name and f_date, the former is filled by calling a pre-block
trigger (this bit works OK separately) and the latter defaulting to
$$date$$.

Result:
When I make the fields display-only, form GENERATE comes back with the asinine
message 'No enterable fields in HEADER; form not generated'.
Of course they're not enterable: that's what I want!

This has something to do with how control blocks are defined, but I've R'd
the F'ing M three times and found only two references to control blocks,
and they add up to 'yes, they exist'. Limitations? Detail? Forget it!
(Designers Reference, V2.0)

When I make the fields enterable to see what would happen if I overcome this
hurdle, I find that Forms obliterates the user field as soon as I do anthing
in the next (database) block. Why can't it leave the user alone? That block
is done with.

So, as an alternative, I tried dropping the HEADER block and incorporating
the u_name and f_date into the database block.

Result: the user id is still trashed after I do anything, but now query
processing screws up because oracle can't find u_name in the table underlying
the block.

Is there a reasonable way to get the user id and the date, display them as
constant text and leave them on the form until exit?

Reply by email and I'll summarise if there is enough interest.

Thanks,

chuck

'4GL: crushing snails with sledgehammers'
-- 
``We're not gonna make it'' -- Scott Tracy

scottj@ncrcae.Columbia.NCR.COM (L. Scott Johnson) (09/13/89)

In article <4245@yarra.oz.au> cm@yarra.oz.au (Charles Meo) writes:
>To all Oracle forms gurus:
>I am currently working on a product admin system for a client, and while
>the definition of forms for database tables is not much of a problem, I'm
>damned if I can see how to do a simple thing like create a nice header
>containing just the current username and the date up the top.
>

	I spent two weeks on this hurdle, and all I could come up with
is the following kludge-fix:

	Block:		DUMB
	Seq:		LAST
	Base Table:	DUAL
	Display in menu:NO

	Field #1:	U_NAME
		CHAR, NON_DATABASE, DISPLAYED, NON_ENTERABLE

	Field #2:	U_DATE
		CHAR, NON_DATABASE, DISPLAYED, NON_ENTERABLE

	Field #3:	DUMMY
		CHAR, DATABASE, DISPLAYED, ENTERABLE

KEY-STARTUP for form:

	#EXEMACRO GOBLK DUMB; EXEQRY;

	select user, to_char(sysdate,'format')
	into dumb.u_name, dumb.u_date
	from dual

	#EXEMACRO GOBLK <first block>;

And alter your KEY-NXTBLK and KEY-PRVBLK to skip DUMB.




Of course, you'll end up with an X (DUMMY) somewhere in the form.  You can
either move it to its own page or hide it 'mongst your graphics.

Additionally, you'd be safer if you altered the KEY-COMMIT to first
do a CLRBLK on DUMB.

----------
L. Scott
scottj@ncrcae.Columbia.NCR.COM