RunModal: Passing Parameters into a new record
allenman
Member Posts: 37
Hello
I have got stuck with a small project I have been given and hope someone can help.
In summary, I have been allowed to add a button to Form 42 Sales Order. I grab "Sales Order" (and "Line No." from the sub form) information.
I test if this is an existing entry in Form2, if so I open Form2 at that record, if not I pass "Sales Order" and "Line No."
paramters and open Form2 as a new record and pre-enter identical "Sales Order" and "Line No." fields on the
Form2 new record.
The first part, the testing if record already exists in Form2 and if so go there works but I just cannot get what I thought would be the easy part of writing a new record on Form2.
I am still very, very new to Navsion so please bear with me, I have this feeling I have missed something obvious!!
On Form 42 Sales Order
Int_SalesLine is a Global Var of Integer type
(Intially I was going to pass back "Line No." to the main form 42. I will remove this variable when all is working.
Function Name: SendLineNo
Function Local Variables: Rec_SalesLine (Var:Yes - DataType: Integer)
On Form 50039 PTR
Function Name: fctPassFromSalesLine
Function Local Variables:
PassSalesOrder ( Var:Yes - Datatype:Code 20)
PassLineNo( Var:Yes - Datatype:Integer)
Form2 has identical text boxes of "Sales Order" and " Line No." but I cannot pre-populate these fields with the passed parameters, they are blank.
So, I have temporaily passed the function parameters to two temp variables (GV_Temp_SO_PTR & GV_Temp_LN_PTR ) instead which
are the source expression for two temp text boxes on form 50039 just to prove to myself that the info is actually being passed correctly - and it is.
Sorry for such a long post and hopefully you are still with me.
Thanks in advance for all help.
Regards,
SteveA
I have got stuck with a small project I have been given and hope someone can help.
In summary, I have been allowed to add a button to Form 42 Sales Order. I grab "Sales Order" (and "Line No." from the sub form) information.
I test if this is an existing entry in Form2, if so I open Form2 at that record, if not I pass "Sales Order" and "Line No."
paramters and open Form2 as a new record and pre-enter identical "Sales Order" and "Line No." fields on the
Form2 new record.
The first part, the testing if record already exists in Form2 and if so go there works but I just cannot get what I thought would be the easy part of writing a new record on Form2.
I am still very, very new to Navsion so please bear with me, I have this feeling I have missed something obvious!!
On Form 42 Sales Order
Int_SalesLine is a Global Var of Integer type
(Intially I was going to pass back "Line No." to the main form 42. I will remove this variable when all is working.
PTR - OnPush() CurrForm.SalesLines.FORM.SendLineNo(Int_SalesLine);On Form 46 Sales Order Sub Form
Function Name: SendLineNo
Function Local Variables: Rec_SalesLine (Var:Yes - DataType: Integer)
--------------------------------------------------
SendLineNo(VAR Rec_SalesLine : Integer) : Integer
--------------------------------------------------
Rec_SalesLine := "Line No.";
Rec_PTR.SETCURRENTKEY("Sales Order","Line No.");
Rec_PTR.SETRANGE("Sales Order","Document No.");
Rec_PTR.SETRANGE("Line No.","Line No.");
IF Rec_PTR.FIND('-') THEN
BEGIN
CLEAR(Frm_PTR_SalesIn);
Frm_PTR_SalesIn.SETRECORD(Rec_PTR);
Frm_PTR_SalesIn.RUNMODAL;
END
ELSE
BEGIN
CLEAR(Frm_PTR_SalesIn);
Frm_PTR_SalesIn.fctPassFromSalesLine("Document No.","Line No.");
Frm_PTR_SalesIn.RUNMODAL;
END
On Form 50039 PTR
Function Name: fctPassFromSalesLine
Function Local Variables:
PassSalesOrder ( Var:Yes - Datatype:Code 20)
PassLineNo( Var:Yes - Datatype:Integer)
----------------------------------------------------------------------------- fctPassFromSalesLine(VAR PassSalesOrder : Code[20];VAR PassLineNo : Integer) ----------------------------------------------------------------------------- GV_Temp_SO_PTR := PassSalesOrder; GV_Temp_LN_PTR := PassLineNo;
Form2 has identical text boxes of "Sales Order" and " Line No." but I cannot pre-populate these fields with the passed parameters, they are blank.
So, I have temporaily passed the function parameters to two temp variables (GV_Temp_SO_PTR & GV_Temp_LN_PTR ) instead which
are the source expression for two temp text boxes on form 50039 just to prove to myself that the info is actually being passed correctly - and it is.
Sorry for such a long post and hopefully you are still with me.
Thanks in advance for all help.
Regards,
SteveA
0
Comments
-
Hi SteveA,
Please correct me if I didn't understand me correctly, but have you tried to clear the record on which your form2 is based then populate your fields on the RECORD and then open your form with this record. Something like this:CLEAR(Frm_PTR_SalesIn); Rec_PTR."Document No" := "Document No"; Rec_PTR."Line No" := "Line No"; Frm_PTR_SalesIn.SETRECORD(Rec_PTR); Frm_PTR_SalesIn.RUNMODAL;
I hope that helps
PS and do not forget to increment your line no before creting new record in the tableBest Regards,
Oleg0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions