Modify fields on form with temp rec
 
            
                
                    grouic                
                
                    Member Posts: 34                
            
                        
            
                    Hello,
EDIT : oops wrong place for my post, my Nav is 4 SP1. Can someone move it in the right location ?
Make a form working with a temp record is a great adventure. Thanksfully to this forum, I found many information to make something working correctly. I still have questions ...
Context : The request is modifying the accounting reversal process to allow fields modification before validating the reversal (like the Posting Date). I added variables on the form 179. Once the field is validated, the corresponding field is modifyed.
This form (179) is populated with a temp record
(T179 : FORM.RUNMODAL(FORM::"Reverse Entries",ReversalEntry);
In the OnOpenForm I added the following code to populate my temp variable ReversalEntry2
I try currform.UPDATE(FALSE) in many triggers, but no result.
1-) Is there any way to update my form ?
2-) I red in the forum some people are writing ReversalEntry2.COPY(Rec) instead of ReversalEntry2 := Rec in the OnFindRecord and OnNextRecord. The behaviour is not the same in my case, all lines are not updated correctly.
What is the result difference between the these two commands ?
Thx experts for your help !
Grouic
                EDIT : oops wrong place for my post, my Nav is 4 SP1. Can someone move it in the right location ?
Make a form working with a temp record is a great adventure. Thanksfully to this forum, I found many information to make something working correctly. I still have questions ...
Context : The request is modifying the accounting reversal process to allow fields modification before validating the reversal (like the Posting Date). I added variables on the form 179. Once the field is validated, the corresponding field is modifyed.
This form (179) is populated with a temp record
(T179 : FORM.RUNMODAL(FORM::"Reverse Entries",ReversalEntry);
In the OnOpenForm I added the following code to populate my temp variable ReversalEntry2
IF FIND('-') THEN
  REPEAT
    ReversalEntry2 := Rec;
    ReversalEntry2.INSERT;
  UNTIL NEXT = 0;
In the OnValidate of my "Posting Date" Variable field I added the code :
IF CONFIRM(TextConfirm01,FALSE,NewRevPostingDate) THEN BEGIN
  IF ReversalEntry2.FIND('-') THEN REPEAT
    ReversalEntry2."Posting Date" := NewRevPostingDate;
    ReversalEntry2.MODIFY;
  UNTIL ReversalEntry2.NEXT = 0;
END ELSE
  NewRevPostingDate := 0D;
and in OnFindRecord, OnNextRecord, OnModifyRecord
//OnFindRecord
ReversalEntry2 := Rec;
IF NOT ReversalEntry2.FIND(Which) THEN
    EXIT(FALSE);
Rec := ReversalEntry2;
EXIT(TRUE);
//OnNextRecord
ReversalEntry2 := Rec;
CurrentSteps := ReversalEntry2.NEXT(Steps);
IF CurrentSteps <> 0 THEN
  Rec := ReversalEntry2;
EXIT(CurrentSteps);
//OnModifyRecord
ReversalEntry2 := Rec;
ReversalEntry2.MODIFY(FALSE);
EXIT(FALSE);
All this stuff works correctly, but I still have a display problem : the whole field column is correctly updated except the current selected line (I have to click on another line an come back on the line to have the correct value displayed).I try currform.UPDATE(FALSE) in many triggers, but no result.
1-) Is there any way to update my form ?
2-) I red in the forum some people are writing ReversalEntry2.COPY(Rec) instead of ReversalEntry2 := Rec in the OnFindRecord and OnNextRecord. The behaviour is not the same in my case, all lines are not updated correctly.
What is the result difference between the these two commands ?
Thx experts for your help !
Grouic
0                
            Comments
- 
            [Topic moved from 'Navision Attain' to 'NAV/Navision Classic Client' forum]0
- 
            Hello,
 EDIT : oops wrong place for my post, my Nav is 4 SP1. Can someone move it in the right location ?
 Make a form working with a temp record is a great adventure. Thanksfully to this forum, I found many information to make something working correctly. I still have questions ...
 Context : The request is modifying the accounting reversal process to allow fields modification before validating the reversal (like the Posting Date). I added variables on the form 179. Once the field is validated, the corresponding field is modifyed.
 This form (179) is populated with a temp record
 (T179 : FORM.RUNMODAL(FORM::"Reverse Entries",ReversalEntry);
 In the OnOpenForm I added the following code to populate my temp variable ReversalEntry2
 Code: Select all
 IF FIND('-') THEN
 REPEAT
 ReversalEntry2 := Rec;
 ReversalEntry2.INSERT;
 UNTIL NEXT = 0;
 In the OnValidate of my "Posting Date" Variable field I added the code :
 Code: Select all
 IF CONFIRM(TextConfirm01,FALSE,NewRevPostingDate) THEN BEGIN
 IF ReversalEntry2.FIND('-') THEN REPEAT
 ReversalEntry2."Posting Date" := NewRevPostingDate;
 ReversalEntry2.MODIFY;
 UNTIL ReversalEntry2.NEXT = 0;
 END ELSE
 NewRevPostingDate := 0D;
 and in OnFindRecord, OnNextRecord, OnModifyRecord
 Code: Select all
 //OnFindRecord
 ReversalEntry2 := Rec;
 IF NOT ReversalEntry2.FIND(Which) THEN
 EXIT(FALSE);
 Rec := ReversalEntry2;
 EXIT(TRUE);
 //OnNextRecord
 ReversalEntry2 := Rec;
 CurrentSteps := ReversalEntry2.NEXT(Steps);
 IF CurrentSteps <> 0 THEN
 Rec := ReversalEntry2;
 EXIT(CurrentSteps);
 //OnModifyRecord
 ReversalEntry2 := Rec;
 ReversalEntry2.MODIFY(FALSE);
 EXIT(FALSE);
 All this stuff works correctly, but I still have a display problem : the whole field column is correctly updated except the current selected line (I have to click on another line an come back on the line to have the correct value displayed).
 I try currform.UPDATE(FALSE) in many triggers, but no result.
 1-) Is there any way to update my form ?
 2-) I red in the forum some people are writing ReversalEntry2.COPY(Rec) instead of ReversalEntry2 := Rec in the OnFindRecord and OnNextRecord. The behaviour is not the same in my case, all lines are not updated correctly.
 What is the result difference between the these two commands ?
 Thx experts for your help !
 Grouic
 Report this post
 Ad 1) Try to update the current rec from the temp in OnfterGetCurrRecord
 Ad 2) The difference is that COPY will copy all filters - it means it work correctly when user set filter on the form, than you need to apply same filter to the temp record, else the result will be wrong for user...0
- 
            Hello,
 1) I tried to put a rec := ReversalEntry2; in the OnAfterGetCurrRecord() => no change
 2) You are right, the filters I put on the form are no more taken in account ](*,)
 I replaced the ReversalEntry2 := Rec; by ReversalEntry2.COPY(Rec); ... but the fields are no more updated on the form, except the last line (I noticed the line are re-sorted ...).
 I'll try other tests.
 Thx for the help
 Grouic0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

