On Insert Trigger and Afte Get Record Trigger

On After get Record seems to intefere with On Insert Trigger. I check for duplicates on the after Get Record; i do no modifications nor any inserts on the Form. I also check on the On Insert Trigger on the Table for Duplicates. On the Form OnAfter I show a Message if duplciates found. On the Table I show an Error if Duplicates found. The Duplcate is based on a NON primary key field. When I use the Navigate buttons on the Form(toolbar) the TABLE “On Insert” Triger gets Fired. How can I solve this PLEASE, I think it is rather Strange since I am not inserting Records.

Is the form-property ‘InsertAllowed’ set on FALSE ??

Insert Allowed is set to YES; If I set this to NO; Insert Trigger on the Table gets Triggered. It seems to have No Effect;

What about the delayed insert property? Is it set to yes?

Delayed Insert is Also not Set to Yes; Strange REsults; I am not Inserting just moving from one record to the NExt; What Causes the Insert Trigger to activate ? when not Inserting records. there is also no Modify of any Record; all I can see that On After Get Record there are some gets that retrieve the Names for some code fields. The Form is linked to a SubForm.

Navigating from one record to the next does not fire the OnInsert trigger. There must be an INSERT(TRUE) statement in the code that searches for duplicates. Are you perhaps using a temporary variable to look for these? I can see how you’d have a temp variable that you fill with the duplicate records. When you INSERT a record in the temp variable, it will fire the OnInsert trigger of the table that it’s based on. But, we will need more details to investigate further :).

export the elements and give us a fob file and we’ll try it out [:D]

Although it does not anser the specific question, whay are you checking for duplicates on the form. Surely the table level test is enough?

thankx for all the answers, it has been some time since my last visit, I can now give some answers: The Table Level check is fine if there are INSERTS; But the Problem is that DUPLICATES Exist and would like to ENCOURAGE the users to fix the DATA, so I put an additional check on the FORM. Ok there is a Delayed Insert on the SUBFORM, well not actually the SubForm, but the form linked to the SubForm. The Temporary variables: well they are VARIABLES and not Fields in the Table when I do GET’S on the Code fields (the Display names); Please help; No Insert. I ran the Code Monitor and dont see anthing there either;

I have just seen that I mark some records on “Sub_Llines”, Headrer ->Lines–>Sub_Lines maybe MARK function makes the system react as if an insert took PLACE? Not sure…

This is very Strange, or not clear yet; on the Form I have somce Code behind the On After GerRecord Trigger; Form A On After GetRecord : Message(‘On After’); Table A On Insert: Message(‘On Insert’); When I Naviagate “On Insert” fires, yet I am not modifying and not inserting; using REcord moved next REcord buttuns. If I remove the On After GetRecord “On Insert” gets triggered. here is the actual Code in my On Modify Header.RESET; Header.SETCURRENTKEY(“Reference Number”,Code); tHeader.SETFILTER(Header.“Reference Number”,’%1’,Rec.“Reference Number”); Header.SETFILTER(Header.Code,’<>%1’,Code); // Dont check against //itself IF Header.FIND(’-’) THEN MESSAGE(‘Booing %1 and Booking %2 have the same Reference Number’,Header.Code,Code); ??? STRANGE ??? [?]

Still only giving half the story but… The way I would be doing this is: The table slevel stuff is obviously fine for the new records. On the form create a function that returns true if there is a duplicate record (basically the code you have below). Now add a new control: if this is a card type form with Tabs, then put the control at the top right, if its a listl, then add a new column. The control will be a bit map, and the source will be the new function. Use a bit map so that False is blank, and true is something like a Red circle, or a Warning sign (exlamation mark). Now as the user is scanning records, they will be given a visible warnign immediataely if there is a duplicate, and will be able to fix it. I do this as a normal process and it works fine. To add to the fucntionality, I oftern add a trigger on the icon, that if clicked, runs the function, and gives an error message to show which record needs to be addressed.

I have Solved the Problem; This is how: (1) I created a New Function Name (2) Then Copied the Code from the Previouse Function into the newly created function; (3) Changed the OnAfter Get Record Trigger to reference the new Function. Now Navision Behaves as it should. ConClusion Do Not Copy Functions from tables to Forms.