InvokeLookup return value question

SOLVED
I am trying to write a script that allows a user to press a button on the SO lines screen to call up the alias item numbers lookup, select a value, and then update a value on the line with a UDF from the selected alias item number. I am able to get the lookup to load, but I'm having an issue with the lookup only returning the itemcode rather then the full key for the alias item so I am unable to query the alias item object successfully. Is there anyway to control 
In the example below, if I press the button with a line with 1001-HON-H252 as the itemcode, I get the correct list of alias items in the lookup, but they all return just 1001-HON-H252 rather then 1001-HON-H252 +AliasItemNo+Type etc....
Is there a way to control what gets returned?
sLineKey = ""
sComment = ""
sItemCode = ""
sAliasItemKey = ""
sItemSeed = ""

set oLines = oBusObj.asObject(oBusObj.Lines)
r = oLines.GetValue("LineKey$", sLineKey)
sEditKey = oLines.GetEditKey(sLineKey)
r = oLines.EditLine(sEditKey)

r = oLines.GetValue("ItemCode$",sItemCode)
itemLength = oSession.AsObject(oSession.FileObj).GetColumnLength("SO_SalesOrderDetail""ItemCode$")
sItemSeed = sItemCode + String(itemLength - Len(sItemCode), Chr(0))
r = oUIObj.InvokeLookup("IM_AliasItemItem",sAliasItemKey,sItemSeed)
msgbox(sAliasItemKey)
Set oAlias = oSession.AsObject(oSession.GetObject("IM_AliasItem_bus"))
r = oAlias.Find(sAliasItemKey)
msgbox(cstr(r))
Parents
  • +1
    verified answer

    I think I found a solution to my problem - though I'm not sure why it works.

    If, instead of using

    r = oAlias.Find(sAliasItemKey)

    to find the record in the AliasItem Table, I use 

    r = oAlias.setbrowsefilter(sAliasItemKey)
    r = oAlias.MoveNext()
    It seems to work just fine - even though if I msgbox(sAliasItemKey) I dont see any of the key data outside of the itemcode.
    If someone is able to explain why this works it would make me happy, but since its functioning correctly I'm not going to bang my head over it any more then I already have.
Reply
  • +1
    verified answer

    I think I found a solution to my problem - though I'm not sure why it works.

    If, instead of using

    r = oAlias.Find(sAliasItemKey)

    to find the record in the AliasItem Table, I use 

    r = oAlias.setbrowsefilter(sAliasItemKey)
    r = oAlias.MoveNext()
    It seems to work just fine - even though if I msgbox(sAliasItemKey) I dont see any of the key data outside of the itemcode.
    If someone is able to explain why this works it would make me happy, but since its functioning correctly I'm not going to bang my head over it any more then I already have.
Children