Scripting adding extended description

Hi All,

   I know I must be missing some basic concept here.   I have  a client that wants to insure that all items have an extended description.    Here is what I have:

sType = ""
retVal = oBusObj.GetValue("ItemType$", sType)
If sType <> "1" Then
Exit Sub

sKey = ""
sDesc = ""
sAdd = " 1"
sNew = ""

retVal = oBusObj.GetValue("ExtendedDescriptionKey$", sKey)
retVal = oBusObj.GetValue("ItemCodeDesc$", sDesc)

if sKey = "" then
sNew = (sDesc + sAdd)
retVal = oBusObj.SetValue("ItemCodeDesc$", sNew)

end if
end if

I think I am not calling the extended description object but I didn't think I needed to do that.   And as a newbie at this, I am not quite sure how to do it (syntax kills me all the time)

Thanks!

Bob Osborn

ACI Consulting

  • 0
    Extended descriptions are created on the fly automatically, as needed. If the reason they want it done is a table join, there is likely an easier way to solve the real problem (vs manually playing with the values within a script).

    And looking at your script, you'll want an "end if" after your "exit sub", otherwise the following lines of code will be ignored.
  • 0 in reply to Kevin M
    Hi Kevin - the client does queries of Sage from other applications. In the other app they have no way of doing a condition for the description if there is an extended description so they want all of the items to have one so they want a script to be sure one is created. I changed the location of the end if (as I mentioned, a rookie...) and it still doesn't create the additional text in the description.
  • 0 in reply to bob47301
    retVal = oBusObj.Write()
    You aren't saving the value. You also don't say how you are triggering the script.

    That being said, an MS Access SQL Specific pass through query, or Linked Server and openquery (from SQL) might be better, because the external database could be pointed at a query, which does the value substitution dynamically.

    If on Premium, it's even easier. Just create a SQL view.