Précédent   Forum des professionnels en informatique > Bases de données > Oracle > Outils > Forms
Forms Forum d'entraide sur Oracle Forms
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 16/08/2005, 14h56   #1
Membre du Club
 
Inscription : mars 2005
Messages : 119
Détails du profil
Informations forums :
Inscription : mars 2005
Messages : 119
Points : 41
Points : 41
Par défaut [Forms6i] FRM-40102 dans bloc multiligne

Bonjour,

Dans un bloc multiligne j'obtiens une erreur FRM-40102 lorsque j'essaie de créer un nouvel enregistrement (via le bouton 'Insérer enregistrement' ou en faisant 'fleche bas' sur la derniere ligne active).
J'ai tracé l'erreur a l'aide du debugger et la situation est la suivante :
- Je clique sur le bouton 'Insérer enregistrement' ce qui me conduit vers le trigger When-new-record-instance
- Dans ce trigger j'appelle une procedure afin d'initialiser mon bloc principal ainsi que d'autres blocs (les blocs détails dépendant de mon bloc principal)
- FRM-40102 apparait lors de la premiere tentative d'initialisation d'un bloc détail alors que je me place bien sur le bloc avant de lancer create_record :

Code :
1
2
GO_BLOCK('BLK_T319');
Create_Record;
Je suis un peu perdu sachant que tout ce que j'ai pu trouver sur le net ou sur metalink etait lié au fait que l'on etait pas positionné sur le bloc via GO_BLOCK....
Qqun a une idée ?
Merci !
lafouine est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2005, 15h33   #2
Rédacteur

 
Avatar de SheikYerbouti
 
Inscription : mai 2003
Messages : 6 533
Détails du profil
Informations forums :
Inscription : mai 2003
Messages : 6 533
Points : 6 469
Points : 6 469
Lorsque vous êtes en création d'enregistrement, vous ne pouvez pas quitter cet enregistrement tant qu'il n'est pas correctement renseigné ou alors supprimé.
__________________
Rédacteur Oracle (Oracle ACE)
Guide Oracle ,Guide PL/SQL, Guide Forms 9i/10g, Index de recherche
Je ne réponds pas aux questions techniques par MP
Blogs: Forms-PL/SQL-J2EE - Forms Java Beans
SheikYerbouti est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2005, 15h44   #3
Membre du Club
 
Inscription : mars 2005
Messages : 119
Détails du profil
Informations forums :
Inscription : mars 2005
Messages : 119
Points : 41
Points : 41
Justement, dans ma procedure je renseigne dans un premier temps les champs de mon bloc principal puis je passe au second via GO_BLOCK() et Create_record...
lafouine est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2005, 17h59   #4
Membre du Club
 
Inscription : mars 2005
Messages : 119
Détails du profil
Informations forums :
Inscription : mars 2005
Messages : 119
Points : 41
Points : 41
Bon je m'en suis sorti en remplacant

Code :
1
2
GO_BLOCK('BLK_T319');
Create_Record;
par

Code :
1
2
3
4
5
6
7
8
GO_BLOCK('BLK_T319_FRM_REVISION');
 
IF :SYSTEM.RECORD_STATUS = 'NEW' THEN	  
SET_RECORD_PROPERTY(TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD')),'BLK_T319_FRM_REVISION', STATUS, INSERT_STATUS); 
END IF;
 
LAST_RECORD;
Create_record;
Je me suis basé sur la note Note:251310.1 de Metalink :

Understanding and Resolving FRM-40102 : Record Must be Entered or Deleted First

PURPOSE
-------

To explain why the error FRM-40102 occurs, and provide tips / work-arounds
as to how to avoid it.


SCOPE & APPLICATION
-------------------

Target Audience: Support Engineers, Consultants, Forms Developers
Some familiarity with Oracle Forms development is expected

Understanding and Resolving FRM-40102 : Record Must be Entered or Deleted First
------------------------------------------------------------------------------------------------------------------------

Here is how the Oracle Forms documentation describes the reasons for why
FRM-40102 occurs:

Cause: You pressed [Next Record] or [Down] in a context where it is
meaningless. Either:

1. The last record in a block is the current record.
2. The block is empty.
3. You are in a new record in the middle of the block created by pressing
[Insert Record].

Action: No action is necessary.
Level: 5
Type: Error

Some typical scenarios with work-arounds provided:
--------------------------------------------------

1. An attempt is made to navigate to the next record in a block. However the
:SYSTEM.RECORD_STATUS of the current record is "NEW". FRM-40102 occurs because
Forms will not allow navigation to the next record status is NEW. This record
may contain values that have not been saved. These values may not have been
typed in by the user, rather than could have derived the 'Default Value' item
property or were programmatically assigned via a trigger e.g WHEN-CREATE-RECORD
Forms marks the record status as NEW when the record is created, regardless
if the items in the record are populated using the Default / Initial Value
property, the Copy item property or programmatic assignment.

Solution Description:

Include a button item in the multi-record block which will display in front of
each record. e.g The button may have the label 'OK'. It will act as an "OK"
button, meaning the user wants to accept the default values that the
record was created with. Set the "Mouse Navigate" property of this button item
to FALSE.

In a WHEN-BUTTON-PRESSED trigger for this button, code:

Code :
1
2
SET_RECORD_PROPERTY(TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD')),'blockname', 
STATUS, INSERT_STATUS);
The code will set the record status from NEW to INSERT allowing the user to
cursor down to the next record without the FRM-40102 error occurring.

Notes:
- A record whose current status is NEW can transition to QUERY or INSERT status,
but cannot transition to CHANGED status.
- FRM-40102 will occur before the WHEN-VALIDATE-RECORD and POST-RECORD triggers
fire, so calling SET_RECORD_PROPERTY in any of these triggers will still not
allow the user to cursor to the next record. The error will occur before the
record status is set to INSERT.

2. Trying to create a new record in a block using DO_KEY('CREATE_RECORD')
built-in e.g called from a WHEN-BUTTON-PRESSED trigger associated with a
button in another block

Solution Description:

A call to the 'CREATE_RECORD' built-in should be made after navigating to the
block based on the database table which will contain the record. For example,
here is a sample code for the WHEN-BUTTON-PRESSED trigger:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
BEGIN 
 
   GO_BLOCK('blockname'); 
   /** If there are records present in the block, the new record to be 
   inserted after the last record **/
   LAST_RECORD;
 
   IF :SYSTEM.RECORD_STATUS != 'NEW' 
   THEN	  
      DO_KEY('CREAT_RECORD'); 
   END IF;
 
END;
3. There can be some perceived inconsistent behaviour when attempting to exit
a form after issuing an 'insert record'. This relates to whether the insert
record is in the middle of a block / inbetween existing records or as the last
record in the block.
For example:

(a) Create two records, commit, insert _record to add a record inbetween two
records but do NOT type in any characters. An attempt to exit is prevented by
the error FRM-40102. It is necessary to issue a clear_record first before an
exit from the Form is allowed

(b) Create two records, commit, insert _record to add a record inbetween two
records but this time type in some characters into fields.
An exit is possible after a 'Do you want to save changes' message.

(c) Create two records, commit, insert_record to be after the last record, but
do NOT type in any characters. An exit is possible, there are no errors or
'Do you want to save changes' messages

(d) Create two records, commit, insert_record to be after the last record, but
this time type in some characters into fields.An exit is possible after a
'Do you want to save changes' message.

(e) Create five records, commit, arrow down and place cursor in row six after
the last record, but do NOT type in any characters. An exit is possible - no
errors or 'Do you want to save changes' message

(f) Create five records, commit, arrow down and place cursor in row six after
the last record, but this time type in some characters into fields. An exit is
possible after a 'Do you want to save changes' message.

Solution Description:

To work-around scenario (a) use a KEY-EXIT form level trigger with the
following sample code:

Code :
1
2
3
4
5
6
7
IF :SYSTEM.CURSOR_VALUE IS NULL
THEN
SET_RECORD_PROPERTY(:SYSTEM.CURSOR_RECORD, 'T' , STATUS, QUERY_STATUS);
EXIT_FORM ;
ELSE
EXIT_FORM;
END IF;
RELATED DOCUMENTS
-----------------

Bug 42992 Abstract: INCONSISTANT BEHAVIOUR OF FORM AFTER <INSERT RECORD>
IN A BLOCK
Bug 364283 Abstract: CANNOT NAVIGATE TO OPEN FORM IF INSERT RECORD -GET
FRM-40102

Note 47233.1 Customizing the 'Do you want to save changes?' Message in Forms

KEYWORDS
-------------------
system.record_status status record insert record exit exit_form insert_record
clear_record frm-40102 suppress eliminate prevent stop forms 4.5 6i 9i runtime
error
lafouine est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h51.


 
 
 
 
Partenaires

Hébergement Web