Where do I find the KeyValues required to use find for IM_ItemVendor_svc

SUGGESTED

Trying to get Standard Lead Time using :


oItemVendSvc = oSession.GetObject("IM_ItemVendor_svc")
if oItemVendSvc then

retVal = oSession.AsObject(oSession.UI).Messagebox("","Able to set handle" & vendNo & itemCode)
Set oItemVendSvc = oScript.AsObject(oItemVendSvc)
retVal = oItemVendSvc.SetKeyValue("ItemCode$", itemCode)
retVal = oItemVendSvc.SetKeyValue("VendorNo$", vendNo)
retVal = oItemVendSvc.Find()
if retVal then
retVal = oSession.AsObject(oSession.UI).Messagebox("","Found The Item " & vendNo & itemCode)
retVal = oItemVendSvc.GetValue("StandardLeadTime", nLeadTimeDays)
end if
end if

I end up getting the first messagebox to show ("Able to set handle") and shows vendor number and itemcode, however after the call of FIND(), there is no response.  Is this because I have not provided the correct key values?  If not, how do I find out what key values are required for each module's find method to work?

Randi

  • 0

    Hi Randy, is your question in regards to Sage 50?

  • 0

    It is Sage 100 Kym

    And I just figured out how to find out the KeyValues ... but it is by opening the table in MS Query and looking for the field names that are bolded.  Is there not another way?

    Randi Hickman 

  • 0 in reply to Sage Employee

    Is there a different area for this type of question?

  • 0 in reply to RHickman

    So you are saying there is no Answer?  

    Ok,

    Thank you

  • 0

    Here is my finalized solution ... just to help someone else out in the future:

    '================================================================================
    'Description: Set UDF_ORIG_REQ_DATE based on lead time for item
    '
    'Created By: Randi Hickman II
    'Create Date: 02/13/2018
    'Table: PO_PurchaseOrderDetail
    'Triggers: RequireDate Pre-Validate
    'UDFs UDF_ORIG_REQ_DATE on PO_PurchaseOrderDetail
    'Other Setup:
    'Special Permissions:
    '================================================================================

    dim vCoCode
    vDate = Date()
    vUDFDate = Date()
    nLeadTimeDays = 0
    vDate = ""
    vORIGREQDATE = Date()
    vUDFDate = Date()
    vendNo = ""
    itemCode = ""
    oItemVendSvc = 0

    vCoCode = oSession.CompanyCode
    'if vCoCode = "TST" then

    oItemVendSvc = oSession.GetObject("IM_ItemVendor_svc")

    retVal = oHeaderObj.GetValue("VendorNo$", vendNo)

    retVal = oBusObj.GetValue("ItemCode$", itemCode)

    oItemVendSvc = oSession.GetObject("IM_ItemVendor_svc")

    if oItemVendSvc then

    Set oItemVendSvc = oScript.AsObject(oItemVendSvc)
    retVal = oItemVendSvc.SetKeyValue("ItemCode$", itemCode)
    retVal = oItemVendSvc.SetKeyValue("VendorNo$", vendNo)
    retVal = oItemVendSvc.SetKeyValue("APDivisionNo$", "00")
    retVal = oItemVendSvc.Find()
    if CBool(retVal) then
    retVal = oItemVendSvc.GetValue("StandardLeadTime", nLeadTimeDays)
    else 'Do not add or subtract any days from the RequiredDate
    nLeadTimeDays = 0
    end if
    end if

    retVal = oBusObj.GetValue("RequiredDate$", vDate)

    ''''this is the area that formats the date correctly to allow for doing a date shift
    formattedDate = ""
    rawDate = ""
    retVal = 0
    retVal = oSession.FormatDate(vDate, formattedDate, "%Mz/%Dz/%Y")
    formattedDate = DateAdd("d", -nLeadTimeDays, formattedDate)
    rawDate = oSession.GetFormattedDate(CStr(formattedDate))
    retVal = oBusObj.SetValue("UDF_ORIG_REQ_DATE$", rawDate)

  • 0 in reply to RHickman

    Is this for a Student version of Sage 100?  Or the regular version of Sage 100?  Just want to make sure this post is in the correct group for future reference.

    Thanks,
    Derek

  • 0 in reply to Derek Vink

    This is my first time to this forum and I was unaware that there was such a division.  I assumed I was a student because I enrolled in Sage U and I was trying to learn about scripting in Sage 100.  If that is not the case, feel free to transfer this post to the appropriate forum.

    Thank you

  • 0 in reply to RHickman

    No problem.  I will move this post to the Sage 100 Support Group.

    Thanks,
    Derek

  • 0
    SUGGESTED

    I find it is easiest to use the File Layouts and Program Information.

    Just locate the table for the object you are after and look at the indexes.