How To get Item No from sales line?

Hai All…

How To get Item No from sales line

like we choose the item, and then if we push on the command button, so it should be message Item No that we select…

I want to send item no as a parameter for new form

thanks before :slight_smile:

I’m not sure about what you’re asking… maybe how to get the Item List filtered by the value you set on field No. of a Sales Line?

almost right galletin

I want to open form from table item ledger entry, that only filtered by Item No. we select…

Sorry !!, I didn’t read your previous response… will have a look later. Anyway to send Item No. as a parameter to a new form you could use the same logical of trigger implementation.

Ok, it’s easy.

You should program the OnLookup trigger of No. field on Sales Line, here you’ll find a parameter “Text” that represents the value of the field on each moment, so you just have to:

  • filter an Item record var, the way “Item.SetFilter(“No.”, parameter*)”
  • display the form Item List with your Item record var (here you’ll have your list filtered)
  • get the Action of the form
  • if Action::OK you’ll have to assign the No. of your Item record var to the No. of Sales Line and MOST important… you’ll need to do and EXIT(true) for the trigger to save changes on your No. field of Sales Line

Uffff I think I could explain better but I’m in a hurry, hope it helps !!

I could give parameter…

the one that i couldn’t find a way, is just to get item no that we select…

by the way thanks for your answer :slight_smile:

Still not sure i you mean Sales Line or Item Ledger entry. But in any case, use properties, there is no need for code. If you can explain a bit clearer WHAT you want to achaive, and not HOW you want to achive it, then we can help you.

If we’re on the same way I have to say that this implementation should be placed on the form, why?, because this is were we find the Text parameter on the OnLookUp trigger. If you have been able to display the filtered Item List, the only thing you need is to return an EXIT(true) statement for changes to take effect.

It’s something like this, I know this could be done in many other better ways so I encourage to somebody to correct or comment my the code [li][li]

IF Text <> ‘’ THEN Item.SETFILTER(“No.”, Text + ‘*’);
IF FORM.RUNMODAL(FORM::“Item List”, Item) = ACTION::LookupOK THEN
BEGIN
Text := rec27.“No.”;
EXIT(TRUE)
END
ELSE
EXIT(FALSE);

hmmmmm… hehehe…

ok David, my question is simple

forget about item ledger entry…

for example, in sales order…

We have 3 items, said Item A (line 10000), B (line 20000), C (line 30000)

I add command button in sales order form

if I select Item B (Line 2000), so it should be a message box said “B”…

do you get it?

i think then u have to write a function in sale order line subform eg.

add/create this function in “Sales Order Subform”

Testfucntion()
if type = type :: Item then
message(‘Item No. : %1’,“No.”);

Add this code in onpush trigger of command button.

- OnPush()
CurrForm.SalesLines.FORM.Testfucntion;

Hope it will help u.

wow ! your code does work !!

thanks a lot !!

I can’t imagine why you need to display this message having Item No. and Name on each line but you can get the selected line info with:
CurrForm.SalesLines.FORM.GETRECORD(varSalesLine);
And then it will be just: message(varSalesLine.“No.”)

Better?

yes Galletin…your code is does work too for me :slight_smile:

by the way, I already get the answer

thanks for all your answer :slight_smile: