BOI Customer data

object[] getResultSetParams = new object[] { "ARDivisionNo$", "CustomerNo$", "", "", "", "", "" }; 

ar_cust_svc.GetType().InvokeMember("nGetResultSets", System.Reflection.BindingFlags.InvokeMethod, null, ar_cust_svc, getResultSetParams, pMods, null, null);

in that code i have the ARDivisionNo and CustomerNo but i need all customers fields how can i get all data thank's

  • 0
    Here is a suggestion. You can use the GetColumns$() method to get a list of fieldnames, then use GetValues() to get the data. Then you need to somehow assign the data to the corresponding fieldname.


    Set oCust = oScript.NewObject("AR_Customer_svc",oSS)

    columns = ""
    columns = oCust.sGetColumns("MAIN") ' returns list of column names separated by hex 8A
    columns = Replace(columns, CHR(138), ",") ' GetValues() needs a list of columns separated by comma

    retVal = oCust.nSetKeyValue("ARDivisionNo$", "01")
    retVal = oCust.nsetKeyValue("CustomerNo$", "ABF")
    retVal = oCust.nFind()

    data = ""
    if retVal = 1 then
    retval = oCust.nGetValues(columns, data) ' return data separated by hex 8A
    msgbox data
    end if
  • 0 in reply to Natasha Chang
    yes but i cant'n do oCust.sGetColumns("MAIN") for example because i do this in c# and the method is
    ar_cust_svc.GetType().InvokeMember("nGetResultSets", System.Reflection.BindingFlags.InvokeMethod, null, ar_cust_svc, getResultSetParams, pMods, null, null); like that so whe i chage the method i have an error
    for example
    ar_cust_svc.GetType().InvokeMember("sGetColumns", System.Reflection.BindingFlags.InvokeMethod, null, ar_cust_svc, getResultSetParams, pMods, null, null); does not work
  • 0 in reply to yoandy valdes
    I hope someone who knows c# can help you out. You need to pass in the string "MAIN".
  • 0 in reply to Natasha Chang

    Hey Natasha,

    I know this post has been out for a while; I was wondering if you know of a way to efficiently get multiple columns of data for all customers.  Thanks!

  • 0 in reply to Sean Gahan

    I think you need to get data for one customer at a time.  If you are on 2018 PU2 or higher, there is a sGetJson() method.  You can pass in nothing and get all columns for a customer or you can pass in a list of comma-delimited column names.  You need to use the business object not the service object (eg. use AR_Customer_bus not AR_Customer_svc).

  • 0 in reply to Natasha Chang

    Thanks for your reply.

  • 0 in reply to Sean Gahan

    Using IvokeMethod:

    Console.WriteLine(ar_cust_svc.InvokeMethod("sGetColumns", "MAIN").ToString().Replace(System.Convert.ToChar(352), '\n'));

    Multiple columns:


    // Setup the parameter list to be passed as reference to the GetResultSets method
    object[] getResultSetParams = new object[] { "CustomerPONo$+\"|\"+InvoiceDate$", "InvoiceNo$", "", "", "", "", "" };
    // Call the GetResultSets to return the list of Customer numbers and names
    ar_cust_svc.InvokeMethodByRef("nGetResultSets", getResultSetParams);

    Wish this forum handled source code like some others, maybe I'm missing something