<Error: 0 in Method GetValue>

SUGGESTED

I've had the below code (which simply reads customer data using the AR_Customer_bus object) running at a client on MAS 200 4.40 for years, we are testing with Sage 100 Advanced 2014, and for some reason, the same code throws the above exception when it attempts to retrieve the 'AddressLine1$' data.  Anyone encounter this?

retVal = oBusCustomer.nSetKeyValue("ARDivisionNo$", arDivisionNo)

retVal = oBusCustomer.nSetKeyValue("CustomerNo$", customerNo)

retVal = oBusCustomer.nSetKey()

retVal = oBusCustomer.nGetValue("CustomerName$", customerName)

retVal = oBusCustomer.nGetValue("CustomerType$", customerType)

retVal = oBusCustomer.nGetValue("AddressLine1$", addressLine1)  <-------Exception thrown here

retVal = oBusCustomer.nGetValue("AddressLine2$", addressLine2)

retVal = oBusCustomer.nGetValue("AddressLine3$", addressLine3)

 

Parents
  • 0
    SUGGESTED

    80020009

    Same problem here - SO and PO modules.

    Upgrading from Sage MAS 200 4.40.0.5 to MAS 100 2013  5.00.7.0.

    Tried on XP, Windows 7 (cmd as 32-bit), Windows 2012 Server Standard (cmd as 32-bit)

    support.microsoft.com/.../896456   (%windir%\SysWoW64\cmd.exe)

    Stand-alone VBS file can write new line to PO, including UDF in question:

    retVal = oPO.oLines.nAddLine()
    retVal = oPO.oLines.nSetValue("ITEMCODE$", "XXXXX")
    retVal = oPO.oLines.nSetValue("UDF_LIST_PRICE$", "519.55")
    retVal = oPO.oLines.nWrite()
    

    Stand-alone VBS file can modify record/row/line on SO, including UDF in question:

    Dim dblUnitCost : dblUnitCost = CDbl(0)
    dblUnitCost  = 125.75
    retVal = oSO.oLines.nSetValue("UDF_UNITCOST", dblUnitCost)
    

    However, more robust script (2k lines HTA (HTML + JS + VBS)) are the problem children.

    Evidently, the problem was if the preceding nSetValue tried to set to null value.

    Addition conditionals to handle the null resolved the problems.

    Perhaps OP has problem where variable weren't initialized correctly per new requirements.

    Strings should to be set to empty string.

    Decimal/double/float should to be set CDbl(0).

    Integer should be set to 0 or whole positive/negative number.

    Objects should be set to 0.

    Try:

    Dim arDivisionNo : arDivisionNo = ""
    Dim customerNo : customerNo = ""
    Dim customerName : customerName = ""
    Dim customerType : customerType = ""
    Dim addressLine1 : addressLine1 = ""
    Dim addressLine2 : addressLine2 = ""
    Dim addressLine3 : addressLine3 = ""
    
    retVal = oBusCustomer.nSetKeyValue("ARDivisionNo$", arDivisionNo)
    retVal = oBusCustomer.nSetKeyValue("CustomerNo$", customerNo)
    retVal = oBusCustomer.nSetKey()
    retVal = oBusCustomer.nGetValue("CustomerName$", customerName)
    retVal = oBusCustomer.nGetValue("CustomerType$", customerType)
    retVal = oBusCustomer.nGetValue("AddressLine1$", addressLine1)  ' <-------Exception thrown here
    retVal = oBusCustomer.nGetValue("AddressLine2$", addressLine2)
    retVal = oBusCustomer.nGetValue("AddressLine3$", addressLine3)
    

    Please post any other insight if this is helpful. If not, the more information you provide, the more helpful this post will be for others.

    thx!

    -GC

Reply
  • 0
    SUGGESTED

    80020009

    Same problem here - SO and PO modules.

    Upgrading from Sage MAS 200 4.40.0.5 to MAS 100 2013  5.00.7.0.

    Tried on XP, Windows 7 (cmd as 32-bit), Windows 2012 Server Standard (cmd as 32-bit)

    support.microsoft.com/.../896456   (%windir%\SysWoW64\cmd.exe)

    Stand-alone VBS file can write new line to PO, including UDF in question:

    retVal = oPO.oLines.nAddLine()
    retVal = oPO.oLines.nSetValue("ITEMCODE$", "XXXXX")
    retVal = oPO.oLines.nSetValue("UDF_LIST_PRICE$", "519.55")
    retVal = oPO.oLines.nWrite()
    

    Stand-alone VBS file can modify record/row/line on SO, including UDF in question:

    Dim dblUnitCost : dblUnitCost = CDbl(0)
    dblUnitCost  = 125.75
    retVal = oSO.oLines.nSetValue("UDF_UNITCOST", dblUnitCost)
    

    However, more robust script (2k lines HTA (HTML + JS + VBS)) are the problem children.

    Evidently, the problem was if the preceding nSetValue tried to set to null value.

    Addition conditionals to handle the null resolved the problems.

    Perhaps OP has problem where variable weren't initialized correctly per new requirements.

    Strings should to be set to empty string.

    Decimal/double/float should to be set CDbl(0).

    Integer should be set to 0 or whole positive/negative number.

    Objects should be set to 0.

    Try:

    Dim arDivisionNo : arDivisionNo = ""
    Dim customerNo : customerNo = ""
    Dim customerName : customerName = ""
    Dim customerType : customerType = ""
    Dim addressLine1 : addressLine1 = ""
    Dim addressLine2 : addressLine2 = ""
    Dim addressLine3 : addressLine3 = ""
    
    retVal = oBusCustomer.nSetKeyValue("ARDivisionNo$", arDivisionNo)
    retVal = oBusCustomer.nSetKeyValue("CustomerNo$", customerNo)
    retVal = oBusCustomer.nSetKey()
    retVal = oBusCustomer.nGetValue("CustomerName$", customerName)
    retVal = oBusCustomer.nGetValue("CustomerType$", customerType)
    retVal = oBusCustomer.nGetValue("AddressLine1$", addressLine1)  ' <-------Exception thrown here
    retVal = oBusCustomer.nGetValue("AddressLine2$", addressLine2)
    retVal = oBusCustomer.nGetValue("AddressLine3$", addressLine3)
    

    Please post any other insight if this is helpful. If not, the more information you provide, the more helpful this post will be for others.

    thx!

    -GC

Children
No Data