Changing the active record of the parent form

jorgito
Member Posts: 115
Hi all.
I have the following situation.
I have created a SubTable that is connected to the Sales Lines. When the user edits a specific sales line, he can press Shift-F9 and open the table SubTable in a form called SubForm that displays info relative to the specific Sales Line record.
The client has requested that the wants to simulate the following functionality with one button click from inside the subform : create a new sales line using the same Item No from the previous record and create a new line for the SubTable connected to the new Sales Line. All this without leaving the subform.
I have created this functionality, but I need to set the focus on the new Sales Line record BEFORE the user closes the SubForm, so that the SubForm shows the new SubTable record.
Any help?
Jorgito
I have the following situation.
I have created a SubTable that is connected to the Sales Lines. When the user edits a specific sales line, he can press Shift-F9 and open the table SubTable in a form called SubForm that displays info relative to the specific Sales Line record.
The client has requested that the wants to simulate the following functionality with one button click from inside the subform : create a new sales line using the same Item No from the previous record and create a new line for the SubTable connected to the new Sales Line. All this without leaving the subform.
I have created this functionality, but I need to set the focus on the new Sales Line record BEFORE the user closes the SubForm, so that the SubForm shows the new SubTable record.
Any help?
Jorgito
0
Comments
-
Try use the Codunit Session with property SingleInstance=Yes (create this codunit).
Create some variables in codunit which detect your sales line
create variable of type Codunit Session in form with sales line and in SubForm
define Session variables In SubForm
Read this variables In form with sales line and use GET
I did it. It works0 -
Sorry. I forgot that BEFORE:jorgito wrote:I have created this functionality, but I need to set the focus on the new Sales Line record BEFORE the user closes the SubForm, so that the SubForm shows the new SubTable record.
So I think to use OnTimer at form with sales line. OnTimer must check the variable at codunit Session0 -
I don't think the OnTimer solution is the best.
Imagine that the parent form shows record P1 which is linked to the S1 record in the SubTable. While the SubForm is open (modally), I want to move the record in the parent form to P2 and so show in the SubForm record S2 (which is linked to P2).
How can I make a variable of the record in the parent form be accessible in the child form. I tried
SalesLineChars.SetParentSalesLine(Rec);
SalesLineChars.RUNMODAL;
where SetParentSalesLine is
SetParentSalesLine(VAR ParentSalesLine : Record "Sales Line")
SalesLine.COPY(ParentSalesLine);
and when the button is clicked I do
SalesLine2.INIT;
SalesLine2.VALIDATE("Document Type", "Document Type");
SalesLine2.VALIDATE("Document No.", "Document No.");
SalesLine2.VALIDATE("Line No.", LineNo);
SalesLine2.VALIDATE(Type, SalesLineTemp.Type);
SalesLine2.VALIDATE("No.", SalesLineTemp."No.");
SalesLine2.INSERT;
SalesLine := SalesLine2;
I imagine that, since SalesLine (inside the subform) was copied from the Rec variable of the parent form, inserting a record would move the cursor to the new record. But it doesn't.
Please, need desperate help!!
Jorgito0 -
Hallo,
try:
SalesLine2.INIT;
SalesLine2.VALIDATE("Document Type", SalesLine."Document Type");
SalesLine2.VALIDATE("Document No.", SalesLine."Document No.");
SalesLine2.VALIDATE("Line No.", SalesLine.LineNo);
SalesLine2.VALIDATE(Type, SalesLineTemp.Type);
SalesLine2.VALIDATE("No.", SalesLineTemp."No.");
SalesLine2.INSERT;
br
Josef Metzbr
Josef Metz0 -
No. It still does not work.
Let me point out that SalesLine is the record I have in the subform that I want to directly reference the records in the parent form.0 -
I am not sure that I totaly understand you but,
Have you tried to create the record before you run the form? So new the record is created before you call the form.run...0 -
I have a SalesLineChar table that has the following fields: Document Type, Document No, Line No, ... (more fields). Each record in the SalesLineChar table corresponds to a Sales Line record. There is a form SalesLineChars that displays this record.
I have a button in the Sales Orders that when it is pressed, it shows the SalesLineChar record for the chosen Sales Line record.
What I want to do is, while showing (modally) the SalesLineChars form, to insert a new line in the Sales Line table and display the (new) record of the SalesLineChar table.
Something like a) close the SalesLineChars form, b) insert a new Sales Line, c) Open the SalesLineChars form again (for the inserted record), WITHOUT CLOSING THE FORM. Just by clicking on a button in the SalesLineChars form.
It is a very complicated situation and the client is quite paranoid, so I have to find a solution for this by Friday.
Please help.0 -
Ok.
A) So you open a form from an existing sales line showing existng char recordYou automaticaly create a new sales line and connected char record
C) You want to focus on the new char record
If this is right you can try changing the orderCreate the new salesline + char record
A) Open the form, using the new char record
C) is done automaticaly.
If this is not possible you can try to use the GET statement in step C.0 -
Mark,
I cannot change the order, because the subform showing the (old) char record is already open and I want to create a new sales line + char WITHOUT CLOSING THE SUBFORM.0 -
Have you tried then doing a get() on the new char record after you have created it?
Like
NewChar.INSERT;
GET(NewChar.Keyfields)
If this does not work, just tell, then we need to be more creative.0 -
While in the Subform, the form shows OldChar and the active Sales Line is OldSalesLine. What I want to do INSIDE THE SUBFORM is:
SalesLine.INSERT;
SalesLine.GET;
SubForm.UPDATE;
So now, the SubForm shows the NewChar (because the active record is NewSalesLine)
Since the Subform is connected to the SalesLineSubform using Document Type, Document No and Line No, if I insert a new line in Char, it won't show, because the active Char line is OldChar and the active Sales Line line is OldSalesLine.
I am pretty sure we must be creative. My deadline is tomorrow and I am running out of time.....
Thanks in advance for all the help you have (will) given me!!
Jorgito0
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
- 320 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