Get the selected record

Hello everyone,

How to get the selected record in Navision?

try with SETSELECTIONFILTER function of form.

No, I want to get the a record which selected.

SETSELECTIONFILTER will do the same…

Yes, you are right.

Thank you

Welcome [:)]

Don’t forget to verify the post which solved your problem!

Hello,

if i want to get the Sales Line selected record on the Sales Order Form, what should i do?

i wrote a function in SalesLine Form:

g_recSalesLine.RESET;
CurrForm.SETSELECTIONFILTER(g_recSalesLine);
IF g_recSalesLine.FIND(’-’) THEN
BEGIN
MESSAGE(FORMAT(g_recSalesLine.“Unit Price”));
END;

but is was no use.

g_recSalesLine.RESET;

g_recSalesLine.SETRANGE(“Document Type”,“Document Type”);

g_recSalesLine.SETRANGE(“Document No.”,“Document No.”);

g_recSalesLine.SETRANGE(“Line No.”,“Line No.”);

If g_recSalesLine.FINDFIRST THEN
MESSAGE(FORMAT(g_recSalesLine.“Unit Price”));

i wote the code in the sales line Form, but it is no use.

I tried, but it is no use.

In which trigger?

you can check with debugger where you are missing…

if you know the primary key field values (in this case document type, the document number and the line number), it’s better to use GET instead of filtering and FINDx.

I could not understand what your said, can you write more clearly?

thank you

He suggested to use

IF g_recSalesLine.Get(“Document Type”,“Document No.”,“Line No.”) THEN

MESSAGE(FORMAT(g_recSalesLine.“Unit Price”));

Thank you!

where should i write the code.

my job is add a Item Calculation Price item in the Functions of the Sales Order Form. when i selected the sales order line in Sales Order subform, then click the Item Calculation Price, the Description of the selected sales line=the unit price of the selected sales line.

i wrote the code in the onAfterGetCurrRecord of the Sales Order Subform, and i can get the unit price. I wrote a function in Sales Order Subform such as Description:=Format(“Unit Price”), when i called this function in Sales Order Form, but it was no use.

I don’t know what is wrong?

can you help me more?

thank you.

Where did you call this function?

There is a gap between your questions and requirement…

tell us exactly where(in which trigger) did you write code and what is the code?