Can General Alias item numbers be purged from Inventory items using Visual Integrator?

Over the years we have accumulated General Alias item numbers in our inventory  that we would like to purge without having to do so one-by-one.  Can it be done through VI?

  • I don't know about VI, but here is a script that I wrote to delete aliases that are the same as the Item Code. You should be able to easily modify it to do what you need. It is not very beautiful, but I only needed to run it once.

    And the usual disclamer... WARNING - BACKUP BEFORE YOU RUN THIS!

    ' Deletes all Aliases where ItemCode = AliasItemNo

    Set oScript = CreateObject("ProvideX.Script")

    oScript.Init("M:\M90V440\MAS90\HOME")

    Set oSession = oScript.NewObject("SY_Session")

    password = Trim(InputBox("Passowrd"))

    ' TODO - better password entry form

    If Not CBool(oSession.nSetUser("DSL", password)) Then

       MsgBox oSession.sLastErrorMsg

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    retVal = oSession.nSetCompany("TEC")

    If retVal = 0 Then

       MsgBox oSession.sLastErrorMsg

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    retVal = oSession.nSetModule("I/M")

    If retVal = 0 Then

       MsgBox oSession.sLastErrorMsg

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    retVal = oSession.nSetDate("I/M", oSession.sSystemDate)

    If retVal = 0 Then

       MsgBox oSession.sLastErrorMsg

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    task = oSession.nLookupTask("IM_Item_ui")

    If task = 0 Then

       MsgBox "task not found"

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    retVal = oSession.nSetProgram(task)

    If retVal = 0 Then

       MsgBox oSession.sLastErrorMsg

       oSession.nCleanup

       oSession.DropObject

       Set oSession = Nothing

       Set oScript = Nothing

       WScript.Quit

    End If

    Set oAlias = oScript.NewObject("IM_AliasItem_bus", oSession)

    retVal = oAlias.nMoveFirst

    Do

       ItemCode = ""

       retVal = oAlias.nGetValue("ItemCode$", ItemCode)

       AliasItemNo = ""

       retVal = oAlias.nGetValue("AliasItemNo$", AliasItemNo)

       If ItemCode = AliasItemNo Then

           retVal = oAlias.nDelete

           If retVal = 0 Then

               MsgBox oAlias.sLastErrorMsg

               oAlias.DropObject

               Set oAlias = Nothing

               oSession.nCleanup

               oSession.DropObject

               Set oSession = Nothing

               Set oScript = Nothing

               WScript.Quit

           End If

       End If

       oAlias.nMoveNext

    Loop Until oAlias.nEOF

    oAlias.DropObject

    Set oAlias = Nothing

    oSession.nCleanup

    oSession.DropObject

    Set oSession = Nothing

    Set oScript = Nothing

    MsgBox "Done"

  • in reply to dlech

    Thanks for the feedback.  Unfortunately, I do mostly data entry and have a bit of experience with Crystal Reports  and Visual Integrator, but I have wouldn't know step one what to do with this information.  

  • in reply to LorryB

    A script would be best as VI is not designed to delete records, just add or edit.

  • in reply to BigLouie

    Hey , resurrecting this old thread as I have a very similar question and would like your (and possibly even 's) opinion on this. I have a client who has hundreds of Item Codes with both V and G Alias Item Numbers. They have a long list of Alias Item Numbers that need to be changed, but my testing has shown that instead of updating the existing numbers it just creates new ones, which is not what they want. 

    My thinking is that I need to:
    A. Export the current numbers.
    B. Have them remove the items that should be changed, keeping only the items that stay the same.
    C. Reinitialize IM_AliasItem.
    D. Import into IM_AliasItem from both the list that doesn't change and the new list with the new numbers (or combine the lists).
    Can anyone think of why this wouldn't work? I'm not sure how, or even if, 's script could work in deleting Alias Item Numbers from a list - there is no common data point that would show which ones to delete - like being the same as the Item Code. I don't see a utility to change these, like the Delete and Change Items.
  • in reply to rclowe

    That's exactly what I would do, and have done for the Price Code file.

  • in reply to bethbowers

    What Beth said.

    Try it in a test company first (to verify your import works), and be careful with the reinit... there is no undo.

  • in reply to Kevin M

    Thanks Beth, appreciate the corroboration. Thanks Kevin, for preaching to the choir Sunglasses