Access the Lines on Transaction Tab in Item Maintenance

Experts, 

I got a tricky one here. I have a UDF in IM_ItemTransactionHistory that contains a file path. Now I would like to be able to place a button in Item Maintenance on the Transactions tab that allows me to open the file.

The code to open the file is simple, but how do I find out which line in the grid currently has focus. In a Sales Order or Invoice, I could probably ask the line object for the key, but how does that work in the grids in Item Maintenance? The Sage drill-down buttons that are already there get that information.

Does anyone have an idea or hint for me?

Thanks,

Bastian

  • 0

    - here is a sample script for reading list box values that I have shared at various Summit's.

    I've attached the following to a button script on the Transaction panel in Item Maintenance that does kind of what you want.  I'm not showing everything, but how you can read the list box value and then use them.

    retVal = 0
    value = ""
    transKey = ""

    retVal = oUIObj.GetValue("LB_Transactions$", value)
    strLen = 0
    columns = 0
    colVal = ""

    strLen = Len(value)

    if strLen<>0 Then
        columns = Split(value, Chr(138))

        ! display each column in the list box

        for each colVal in columns
           colCtr = colCtr +1
            msgbox Cstr(colCtr) & " " & colVal

            if colCtr=1 then transKey = colVal end if

        next

    end if

    msgbox transkey

    oTransHist = 0
    Set oTransHist = oSession.AsObject(oSession.GetObject("IM_ItemTransactionHistory_bus"))

    rVal = 0
    rVal = oTransHist.SetKey(transKey)
    msgbox "SetKey = " + Cstr(rVal)

    If rVal=1 Then

        ' use GetValue() to retrieve name of filename UDF and open or whatever you want to do with it.

    End If

    Hope this helps

    Elliott

  • 0 in reply to jepritch

    Thank you Elliot!

    I am in a Sage 100 Advanced environment and need to run the script on the client (because I need to open the attachment file). I am not sure how I get to the UIObj. Is that possible?