Scripting

  • 1.  What is the best way to script pulling in desired

    Posted 06-14-2017 13:13
    What is the best way to script pulling in desired values when trying to link out to a one-to-many table? I am trying to override what standard Sales Order Entry does when bringing in the AliasItemNo for a line and instead look for a General Alias with a Description of ""UPC CODE"". But an item can have many aliases, so how do I search for and pull in only the one that I want? I started with the script below, but am stumped. I found an old post by Alnoor back in 2011 that mentions copying data to a shadow table and then linking from there instead. Is that the best (or only) option at this point would be to populate a Shadow UDT of only these specific aliases and pull from there into the Lines? Thanks in advance for any guidance! 'Reset Variables sItemCode = """" : sItemType = """" : sAliasItem = """" : sAliasDesc = """" oAlias = """" : retval = 0 retVal = oBusObj.GetValue(""ItemCode$"", sItemCode) retVal = oBusObj.GetValue(""ItemType$"", sItemType) if sItemType <> ""1"" then exit sub end if 'Set IM_AliasItem Object and Primary Key Set oAlias = oSession.AsObject(oSession.GetObject(""IM_AliasItem_bus"")) retVal = oAlias.SetKeyValue(""ItemCode$"", sItemCode) retVal = oAlias.Find() if retval = 1 then retval = oAlias.GetValue(""AliasItemNo$"", sAliasItem) retval = oAlias.GetValue(""AliasItemDesc$"", sAliasDesc) if sAliasDesc = ""UPC CODE"" then retval = oBusObj.SetValue(""AliasItemNo$"", sAliasItem) end if end if


  • 2.  RE: What is the best way to script pulling in desired

    Posted 06-14-2017 13:19
    I'd use GetResultSets for this.


  • 3.  RE: What is the best way to script pulling in desired

    Posted 06-14-2017 13:21
    SetBrowseFilter and loop through results until you find what you want.


  • 4.  RE: What is the best way to script pulling in desired

    Posted 06-14-2017 13:23
    (Using alternate index KITEMCUSTOMER, remembering to set the index back to KPRIMARY when done).


  • 5.  RE: What is the best way to script pulling in desired

    Posted 06-14-2017 13:55
    Thank you both. I will search for these functions in my class materials to see if I can learn how to use them.