How do I use "OnLookup"?

RainerRainer Member Posts: 103
What is wrong..?

I cannot return the Itemcategory.Code to the salgesline. Also if I do same in the field "Product Group", I need to set range on the Product Group List to see only "product groups" of the "Category" from the salesline.

The record is salesline:

Category - OnLookup()

IF (category = '') THEN BEGIN

frmItemCategory.SETTABLEVIEW(ItemCategory);
frmItemCategory.SETRECORD(ItemCategory);
frmItemCategory.LOOKUPMODE(TRUE);

IF frmItemCategory.RUNMODAL = ACTION::LookupOK THEN BEGIN
validate(Category,ItemCategory.Code);
//some code 1
//some code 2
END;
END ELSE BEGIN

Item.SETRANGE("Item Category Code",Category);
frmItemList.SETTABLEVIEW(Item);
frmItemList.SETRECORD(Item);
frmItemList.LOOKUPMODE(TRUE);

IF frmItemList.RUNMODAL = ACTION::LookupOK THEN
validate("No.", Item."No.";
END;

CLEAR(frmItemCategory);
Kind Regards

E-mail: info@rainerbay.dk
Skype: rainerbaydk

Comments

  • wonmowonmo Member Posts: 139
    right after " IF frmItemCategory.RUNMODAL = ACTION::LookupOK THEN BEGIN" use "frmItemCategory.GETRECORD(lItemCategory)" and then use:

    validate(Category,ItemCategory.Code);
    some code
    some code
    ...
  • RainerRainer Member Posts: 103
    Thanks.... allways small thinks... but works great !!
    Kind Regards

    E-mail: info@rainerbay.dk
    Skype: rainerbaydk
Sign In or Register to comment.