how to assign filed from table to another

MRQ
Member Posts: 73
hi
ihave problem to assign the filed "Docuomant type" and Documant No."
and "Line No." from Sales Line to another table called TEST i add Button
in the sales order sub form and write this code OnPush Event
and in the GetSalesLine Function i try to assign the function parameter to the filed Put Nathing happened
any one can help plz ](*,)
ihave problem to assign the filed "Docuomant type" and Documant No."
and "Line No." from Sales Line to another table called TEST i add Button
in the sales order sub form and write this code OnPush Event
//GetSalesLine is function in the TestCard Form // the 99508 is the testCard form id testCard.GetSalesLine("No.","Document Type","Document No."); FORM.RUN(99508);
and in the GetSalesLine Function i try to assign the function parameter to the filed Put Nathing happened
//GetSalesLine have 3 parameter // No code[20] // Type option //DocNo code[20] "No.":=No; "Document Type":=Type; "Document No.":=DocNo;
any one can help plz ](*,)
0
Comments
-
Not sure, but ...
In place of calling the form by FORM.RUN() , use TestCard.RUN instead, so you are sure you work on the same instance of the form ...0 -
Just try
SalesLine.Get(Type,DocNo,No)
in the getsalesline function. With your code you're trying to modify the record itself (even than you wold have to insert an salesline.modify).0 -
thanx halmdy janv
but the problen not solve yet
janv this the function GetSalesLine after modifying the codeSalesLine.GET(Type,DocNo,LineNo); "Line No.":=SalesLine."Line No."; "Document Type":=SalesLine."Document Type"; "Document No.":=SalesLine."Document No.";
no error but the filed in the TestCard still empty ](*,) ](*,)0 -
Have you tried giving the record to the form as parameter
Form.RUN(Form::"Te Form", Record);0 -
Ok, first of all delete following code in yor function:
"Line No.":=SalesLine."Line No."; "Document Type":=SalesLine."Document Type"; "Document No.":=SalesLine."Document No.";
as with this code you're trying to assign new values.
Maybe you can replace the "get"-statement throug a form.setrecord like in
form.setrecord(salesline) and then run the form.
BTW, what do you mean with "button in subform"? Did you really put it into the subform or did you just put it next to the other buttons?0 -
hi Mark Brummel thanx man
but i cant useForm.RUN(Form::"Te Form", Record);
couse the 2 tables have deferunt fileds just 3 of the fileds shared between the two table0 -
Yes, but the record thing must be a variable, based on the record from the form.
For example,
If you want to open the item card from a sales line, the "No." from the salesline is the "No." from the item.
You should the define an Item record variable and to something likeItem.GET(Rec."No."); Form.RUN(FORM::"Item card", Item);
I Hope this clarifies things.0 -
Mark Brummel you r right but in my case there is no data in the
TEST Table
so if i applay the folwing codeTest.GET(Rec."No."); Form.RUN(FORM::"Test card", test);
this error come outtest No. 1996-s does not exist0 -
What is the key of the test table?
You have the primary key available or do you have other link fields?
If you for instance know the name of an item you can doItem.Setrange(Name, IKnowTeName); Form.Run(Form::"item card", ITEM);
Instead of the get.0 -
ok mark i think there is misunderstanding; my case is
I have no perdifined items, let say I want to sell tickets but each ticket is much diferrent than the others and this diferrence is impossible to be preknown so we can't define each ticket as an individual item so we defined (Ticket category) as an item and therefore when you select the (Ticket category) in the sales order a new window must open to allow me to enter the details of this ticket. Now the primary key for the sales lines consists of three fields; document type, document no. and the line no. The primary key for the ticket window -the new window- is the same.
My problem is how to copy the values found in those fields in the sales lines to the new window -ticket card- because we want to link the ticket to its corresponding sales line.
Thanks again man for your precious time0 -
Ok, I think I am beginning to understand.
You could try to do something like this. (Assuming there is no ticket)Ticket.init; Ticket."Document No." := SalesLn."Document No."; Ticket."Document Type" := SalesLn."Document Type"; Ticket."No." := SalesLn."No."; Ticket.INSERT; FORM.RUN(Form::"Ticket Card", Ticket);
And if the ticket exists:Ticket.GET(SalesLn."Document No.". SalesLn."Document Type", SalesLn."No."); FORM.RUN(Form::"Ticket Card", Ticket);
0 -
thanx mark its work now \:D/ thank u again0
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