larned@uhccux.uhcc.Hawaii.Edu (Paul Larned) (01/30/91)
I am using version 5.1b for MSDOS, and forms 2.3 to develop an application. In one screen I have a block showing four records from a table, one line each, in descending order by a date field. Thus, the most recent record is the top line of the block. I want to provide for input of new records, and logically the next new record should provide a blank line ABOVE the most recent record for data input. However, when I press the [create record] key, I get a blank line BELOW the first record. I have tried using another block to simulate the table block, but cannot write the appropriate commit statements to insert data into the table only if the "new record" block is not null (in other words, I want to give the end-user the option of NOT entering a new record, only updating an old one). In fact, if I try to write an "insert" statement in a KEY-COMMIT trigger, I get an error "only select statements in non-commit triggers". This makes little sense to me. Naturally, I cannot find help in the manuals. This seems like a logical thing to want to do--are there any suggestions? Thanks, Paul Larned larned@uhccux.uhcc.hawaii.edu
lugnut@sequent.UUCP (Don Bolton) (01/31/91)
In article <11183@uhccux.uhcc.Hawaii.Edu> larned@uhccux.uhcc.Hawaii.Edu (Paul Larned) writes: >I am using version 5.1b for MSDOS, and forms 2.3 to develop an application. >In one screen I have a block showing four records from a table, one line >each, in descending order by a date field. Thus, the most recent record is >the top line of the block. I want to provide for input of new records, and >logically the next new record should provide a blank line ABOVE the most >recent record for data input. However, when I press the [create record] >key, I get a blank line BELOW the first record. I've yet to see it work any different. I have one screen where one navigates up and down via a non database field. I've protected the database fields on purpose. A user must select an "add" option that I've defined to enter data in a new row. It will open an new row BELOW *regardless* whether the current row is blank or not. Looks confusing, but it doesn't attemt to insert a null row so I've just told my users its a feature :-) >I have tried using another block to simulate the table block, but cannot >write the appropriate commit statements to insert data into the table only >if the "new record" block is not null (in other words, I want to give the >end-user the option of NOT entering a new record, only updating an old >one). In fact, if I try to write an "insert" statement in a KEY-COMMIT >trigger, I get an error "only select statements in non-commit triggers". >This makes little sense to me. > what you want is simple reallly. POST-COMMIT #exemacro exeqry; Yeah your line will insert "in a funny place" but the requery will re-order the screen. Where this might suck eggs, is if you have say 30 records and you insert on "row 25", after the requery, you'll be back at "row 1" Note: I've used a post commit. I believe you may have to use key commit as in #exemacro commit;exeqry; Or you may need to call a user defined trigger that does the query for you. (its been awhile since I've been Oracleing) But I believe you will have to live with *where* the freshly inserted row goes, I'd be *real* interested if there is a way around that one. Part of Oracle's beauty is the myriad of things it manages for the developer, those things are also part of the frustration at times :-) --------------------------------------------------------------------------- Opinions expressed herein are genuine lugfodder [tm] and may not reflect the opinions of any rational people in the civilized world, or my employer either.