and how do you want to do that ? there can be more than 1 line on a sales document, so there is no such things as THE item description to show there.
if you just want the first then there are several ways to accomplish that :
- Add code in the OnAfterGetRecord of the form to collect the description you want to show into a global variable, and add that var. to the form.
- Add a function to the Sales header table that does the same as the above, and add that function in a field on the form.
if you just want the first then there are several ways to accomplish that :
- Add code in the OnAfterGetRecord of the form to collect the description you want to show into a global variable, and add that var. to the form.
- Add a function to the Sales header table that does the same as the above, and add that function in a field on the form.
Valid ways, but don't write code if you don't have to. A simple flowfield will do the trick...that is if you do really just want the first description.
and how do you want to do that ? there can be more than 1 line on a sales document, so there is no such things as THE item description to show there.
if you just want the first then there are several ways to accomplish that :
- Add code in the OnAfterGetRecord of the form to collect the description you want to show into a global variable, and add that var. to the form.
- Add a function to the Sales header table that does the same as the above, and add that function in a field on the form.
As i am new to navision can u pls give me the code for both schenario.
As expert said, do not try to go typical just take a rec var for item and show description to help it like
Recitem.get("sales line".no);
and write in text box recitem.description.
i think it would be helpful to u.
As expert said, do not try to go typical just take a rec var for item and show description to help it like
Recitem.get("sales line".no);
and write in text box recitem.description.
i think it would be helpful to u.
hi thanx for the reply, i got the point but if i am doing so i am getting an error "Item No. does not exist"
can u plz tell me the reason
As expert said, do not try to go typical just take a rec var for item and show description to help it like
Recitem.get("sales line".no);
and write in text box recitem.description.
i think it would be helpful to u.
Hi i have declared to global rec variables and one text variable
ItemRec-> Item
SalesLine->Sale Line
Description->Text
Actually according to our client requirement i want to add Item No and Description on the sales list form. plz note that there will be only one item per Sales order.
here i have created two fields "Item No." and "Item Description" on Sales Header table and had written the following code in OnPush trigger on Release Menu Item:
SalesHeader."Item No.":=SalesLine."No."; // I had also tried putting constant here
SalesHeader."Item Description":=SalesLine.Description;
SalesHeader.MODIFY;
Am i going on right track, can anybody suggest me the proper solution as i have been frusted doing this from last one week.
1) I will not comment the "why" for that and the "what if you have more lines"... ;-)
2) You can use GET on the header, you know exactly the primary key, do not use SETRANGE/SETFILTER and FIND when you knwo primary keys values.
3) Look at this your code:
alesHeader.RESET;
SalesHeader.SETRANGE("No.",SalesLine."Document No.");
SalesHeader.SETRANGE(SalesHeader."No.","No.");
SalesHeader."Item No.":=SalesLine."No."; // I had also tried putting constant here
SalesHeader."Item Description":=SalesLine.Description;
SalesHeader.MODIFY;
You are setting two filters on same field of SalesHeader... ;-) What is Rec in this code? If I "clean" this code, it looks like:
alesHeader.RESET;
SalesHeader.SETRANGE("No.",SalesLine."Document No.");
SalesHeader.SETRANGE("No.","No.");
SalesHeader."Item No.":=SalesLine."No."; // I had also tried putting constant here
SalesHeader."Item Description":=SalesLine.Description;
SalesHeader.MODIFY;
Can you see the problem? ;-)
And there is one thing - you are filtering and then modifying, what about reading the record first before you modify it? (GET) :whistle:
Comments
if you just want the first then there are several ways to accomplish that :
- Add code in the OnAfterGetRecord of the form to collect the description you want to show into a global variable, and add that var. to the form.
- Add a function to the Sales header table that does the same as the above, and add that function in a field on the form.
Valid ways, but don't write code if you don't have to. A simple flowfield will do the trick...that is if you do really just want the first description.
My Blog - nav.education
I've done that in the past. With some knowledge of SQL Server views and how to create a NAV form for that, it's not that difficult.
But I also would ask: why would you want that?
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
That i can do but i am using the Native Database.
As i am new to navision can u pls give me the code for both schenario.
Recitem.get("sales line".no);
and write in text box recitem.description.
i think it would be helpful to u.
hi thanx for the reply, i got the point but if i am doing so i am getting an error "Item No. does not exist"
can u plz tell me the reason
Hi i have declared to global rec variables and one text variable
ItemRec-> Item
SalesLine->Sale Line
Description->Text
and have written the following code:
Item.GET("Sales Line"."No.");
Description:=SalesLine.Description;
here i have assigned description as source expr to text box but its giving an error when i am running the form.
i have also tried this Textbox->source expr-> ItemRec.Description
plz suggest me the soln
Hi lvanvugt,
Kindly explain how to create Nav Form based on View created in Sql Server.
Actually according to our client requirement i want to add Item No and Description on the sales list form. plz note that there will be only one item per Sales order.
here i have created two fields "Item No." and "Item Description" on Sales Header table and had written the following code in OnPush trigger on Release Menu Item:
SalesHeader.RESET;
SalesHeader.SETRANGE("No.",SalesLine."Document No.");
SalesHeader.SETRANGE(SalesHeader."No.","No.");
SalesHeader."Item No.":=SalesLine."No."; // I had also tried putting constant here
SalesHeader."Item Description":=SalesLine.Description;
SalesHeader.MODIFY;
Am i going on right track, can anybody suggest me the proper solution as i have been frusted doing this from last one week.
2) You can use GET on the header, you know exactly the primary key, do not use SETRANGE/SETFILTER and FIND when you knwo primary keys values.
3) Look at this your code: You are setting two filters on same field of SalesHeader... ;-) What is Rec in this code? If I "clean" this code, it looks like: Can you see the problem? ;-)
And there is one thing - you are filtering and then modifying, what about reading the record first before you modify it? (GET) :whistle:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Hope it makes sense. :P
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
can u plz help me.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
thanx for ur valuable support, issue is resolved.