How would I search “Location” based on primary keys such as BAccountID and LocationID through Web Service API?

不羁的心 提交于 2019-12-13 04:54:29

问题


As I indicated in my another question at Is there any way to get BAccountID when searching Business Account, or update Business Account based on those primary keys through Web Service API?, I was trying to get Primary Key value such as BAccountID from BAccount table, which I did - thanks to @Stan 's help - now I need to search "Location" based on BAccountID and LocationID, which are two primary keys in "Location" table; however, I couldn't get it work.

Can somebody give me a help to show me how to get it work? @Stan, would you please help me again?

Thanks!

As @ryanyuyu suggested, the following is what I tried but didn't work:

CR303010Content CR303010 = context.CR303010GetSchema();
context.CR303010Clear();

List<Command> cmds = new List<Command>();
cmds.Add(CR303010.LocationSummary.ServiceCommands.EveryLocationID);

cmds.Add(CR303010.LocationSummary.LocationID);
cmds.Add(CR303010.LocationSummary.LocationName);

List<Filter> filters = new List<Filter>();

filters.Add(new Filter()
{             
   Field = NewA4Field(CR303010.LocationSummary.BusinessAccount.ObjectName, "BAccountID"), 
   Value = "8145",
   Condition = FilterCondition.Equals,
   Operator = FilterOperator.And
});
filters.Add(new Filter()
{
  Field = NewA4Field(CR303010.LocationSummary.LocationID.ObjectName, "LocationID"),
  Condition = FilterCondition.Equals,
  Value = "9488",
});
 var CR303010Export = context.CR303010Export(cmds.ToArray(), filters.ToArray(), 0, false, false);

public static apisalesorder.Field NewA4Field(string objName, string fldName)
{
        apisalesorder.Field nv = new apisalesorder.Field();
        nv.ObjectName = objName;
        nv.FieldName = fldName.TrimEnd();
        return nv;
}

回答1:


As @Gabriel suggested, I'm going to use Customer code and Location code to get Location info and if I do need to get Location data based on primary keys, I will use Generic Inquiry instead. Thanks for Gabriel's help!



来源:https://stackoverflow.com/questions/30109471/how-would-i-search-location-based-on-primary-keys-such-as-baccountid-and-locat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!