Hello,
I am currently on CSI 10.0.0.496 Cloud. I have a few request to add properties to dataviews/reports which will require the writing of an ido custom assembly. I have two questions.
1) Is there a way to debug a custom assembly when in the cloud? How would I even display a couple of values of variables on the screen during execution?
2) I wrote an assembly tin C# to add a country property to the Order Status Report dataview. When I run the dataview, the country shows up blank. Would someone please look at my code and tell me what the problem(s) are please? It is a class library using .NET framework 4.7.2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mongoose.Core.Common;
using Mongoose.Core.DataAccess;
using Mongoose.IDO;
using Mongoose.IDO.Protocol;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Data;
namespace ue_JMW_SLOrderStatusReport
{
// [IDOExtensionClass( "ue_JMW_SLOrderStatusReport" )]
public partial class ue_JMW_SLOrderStatusReport : IDOExtensionClass
{
#region
DataTable dtable = new DataTable();
#endregion
public void LogTransaction(string strModName, string strProgramName, string strTransName, string strParams, string strComments)
{
UpdateCollectionRequestData request = new UpdateCollectionRequestData();
UpdateCollectionResponseData response;
IDOUpdateItem newCust = new IDOUpdateItem();
request.IDOName = "ue_DummyIDO";
request.RefreshAfterUpdate = true;
newCust.Action = UpdateAction.Insert;
newCust.ItemNumber = 1;
// used for error reporting
newCust.Properties.Add("ModName", strModName);
newCust.Properties.Add("ProgramName", strProgramName);
newCust.Properties.Add("TransactionName", strTransName);
newCust.Properties.Add("Parms", strParams);
newCust.Properties.Add("Comments", strComments);
request.Items.Add(newCust);
response = this.Context.Commands.UpdateCollection(request);
}
public DataTable ue_JMW_OrderStatusReportGetData(string StandardInputParms)
{
try
{
// LogTransaction("", "", "", "", "StandardInputParms" + StandardInputParms);
LoadCollectionResponseData loadCol;
//LoadCollectionResponseData loadColCust;
string StdOutputParms = "";
loadCol = GetStandardReportData(StandardInputParms, ref StdOutputParms);
// LogTransaction("", "", "", ""+loadCol.Items.Count.ToString(), "After processing");
if (loadCol.Items.Count == 0) return dtable;
DataRow dtRow;
//<---adding columns to datatable
if (string.IsNullOrEmpty(StdOutputParms)) return dtable;
//LogTransaction("", "", "", "", "Before processing");
string[] StdOutputParmsArr = StdOutputParms.Split(',');
for (int k = 0; k < StdOutputParmsArr.Length; k++)
dtable.Columns.Add(StdOutputParmsArr[k].ToString());
string[] StrdIpParmsArr = StandardInputParms.Split(',');
// --> Adding new columns
dtable.Columns.Add("ue_JMW_Country");
var CountryResult = new List<Country>();
LoadCollectionResponseData LoadCustomerAddr = new LoadCollectionResponseData();
LoadCustomerAddr = this.Context.Commands.LoadCollection("SLCustAddrs", "RowPointer,CustNum,Country", "", "", 0);
if (LoadCustomerAddr.Items.Count > 0)
{
for (int h = 0; h < LoadCustomerAddr.Items.Count; h++)
{
Country CountryDetail;
CountryDetail = new Country();
CountryDetail.CustNum = LoadCustomerAddr[h, "CustNum"].Value;
CountryDetail.STCountry = LoadCustomerAddr[h, "Country"].Value;
CountryResult.Add(CountryDetail);
}
}
for (int j = 0; j < loadCol.Items.Count; j++)
{
dtRow = dtable.NewRow();
for (int i = 0; i < StdOutputParmsArr.Length; i++)
{
if (StdOutputParmsArr[i] != "ue_JMW_Country")
{
dtRow[StdOutputParmsArr[i]] = loadCol[j, StdOutputParmsArr[i]];
}
}
if (CountryResult.Any())
{
var CountryVar = CountryResult.Where(a => a.CustNum == loadCol[j, "CustNum"].Value).Select(b => b.STCountry).FirstOrDefault();
if (string.IsNullOrEmpty(CountryVar))
CountryVar = "";
dtRow["ue_JMW_Country"] = CountryVar;
}
else
{
dtRow["ue_JMW_Country"] = "";
}
dtable.Rows.Add(dtRow);
}
}
catch (Exception e)
{
// LogTransaction("", "", "", "", "" + e);
}
// LogTransaction("", "", "", "", "result dtable" + JsonConvert.SerializeObject(dtable));
return dtable;
}
public LoadCollectionResponseData GetStandardReportData(string StandardInputParms, ref string StdOutputParms)
{
LoadCollectionResponseData loadCol;
string OutputParms = "";
loadCol = Context.Commands.LoadCollection("IdoMethodResultSets", "CollectionName,MethodName,PropertyName,Sequence", "CollectionName='SLOrderStatusReport' AND MethodName='Rpt_OrderStatusSp'", "Sequence", 0);
// Ido method invoke start
if (loadCol.Items.Count == 0) return null;
// LogTransaction("", "", "", "", "Count"+ loadCol.Items.Count);
for (int i = 0; i < loadCol.Items.Count; i++)
{
OutputParms += loadCol[i, "PropertyName"].Value + ",";
}
OutputParms = OutputParms.TrimEnd(',');
StdOutputParms = OutputParms;
LoadCollectionRequestData requestLoadCol = new LoadCollectionRequestData();
// LoadCollectionResponseData responseLoadCol = new LoadCollectionResponseData();
requestLoadCol.IDOName = "SLOrderStatusReport";
requestLoadCol.PropertyList.SetProperties(OutputParms);
requestLoadCol.CustomLoadMethod = new CustomLoadMethod();
requestLoadCol.CustomLoadMethod.Name = "Rpt_OrderStatusSp";
if (!string.IsNullOrEmpty(StandardInputParms))
{
string[] StandardParmsArr = StandardInputParms.Split(',');
for (int k = 0; k < StandardParmsArr.Length; k++)
{
requestLoadCol.CustomLoadMethod.Parameters.Add(StandardParmsArr[k].ToString());
}
}
requestLoadCol.RecordCap = 0;
requestLoadCol.OrderBy = "";
loadCol = Context.Commands.LoadCollection(requestLoadCol);
// LogTransaction("", "", "", "", "Count of whole data" + loadCol.Items.Count);
return loadCol;
}
public class Country
{
public string CustNum;
public string STCountry;
}
}
}