I need to get customer data from sage100 using .Net code. I went through https://help-sage100.na.sage.com/2018/FLOR/index.htm but could not understand the functions as there was no clear instructions. I managed to get data from two columns using a sample code but I need data of all columns from customer inquiry.
I attached the .Net sample code I found. (This is my first time on here so not sure how it works.)
I tried multiple things such as giving more params to the functions but did not work and this code only returns data of 2 columns.
// Instantiate a ProvidexX.Script object and initialize with the path to MAS90\Home pvx = System.Activator.CreateInstance(Type.GetTypeFromProgID("ProvideX.Script", true)); // Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below pvx.GetType().InvokeMember("Init", System.Reflection.BindingFlags.InvokeMethod, null, pvx, new object[] { Sage100_SagePath }); // Instantiate a new Session object and initialize the session // by setting the user, company, date and module oSS = pvx.GetType().InvokeMember("NewObject", System.Reflection.BindingFlags.InvokeMethod, null, pvx, new object[] { "SY_Session" }); oSS.GetType().InvokeMember("nSetCompany", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { Sage100_CompanyName }); oSS.GetType().InvokeMember("nSetDate", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "S/Y", "02282017" }); oSS.GetType().InvokeMember("nSetModule", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "S/Y" }); oSS.GetType().InvokeMember("nSetUser", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { Sage100_UserName, Sage100_Password }); oSS.GetType().InvokeMember("nLogon", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null); // Get the Task ID for the AR_Customer_ui program int TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "Ar_Customer_ui" }); // Pass the Task ID to the SetProgram method to get a security object to access the AR Customer object oSS.GetType().InvokeMember("nSetProgram", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { TaskID }); // Instantiate a new AR_Customer_svc object ar_cust_svc = pvx.GetType().InvokeMember("NewObject", System.Reflection.BindingFlags.InvokeMethod, null, pvx, new object[] { "Ar_Customer_bus", oSS }); // Setup the parameter list to be passed as reference to the GetResultSets method object[] getResultSetParams = new object[] { "ARDivisionNo$", "CustomerNo$", "", "", "", "", "" }; System.Reflection.ParameterModifier pmods = new System.Reflection.ParameterModifier(7); pmods[2] = true; pmods[3] = true; System.Reflection.ParameterModifier[] pMods = new System.Reflection.ParameterModifier[] { pmods }; // Call the GetResultSets to return the list of Customer numbers and names ar_cust_svc.GetType().InvokeMember("nGetResultSets", System.Reflection.BindingFlags.InvokeMethod, null, ar_cust_svc, getResultSetParams, pMods, null, null); List<string[]> data = new List<string[]>(); foreach (var result in getResultSetParams) { Console.WriteLine(); Console.WriteLine(); Console.WriteLine(result.ToString()); data.Add(result.ToString().Split('\x0160')); }