NetSuite SuiteTalk-从"SearchColumnSelectField"检索值字符串 [英] NetSuite SuiteTalk - Retrieve Value String From “SearchColumnSelectField”

查看:104
本文介绍了NetSuite SuiteTalk-从"SearchColumnSelectField"检索值字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您正在尝试从SuiteTalk访问一个以"SearchColumnSelectField"类型返回的值:

Say you are trying to access a value from SuiteTalk that is returned as type "SearchColumnSelectField":

((TransactionSearchRow)row).basic.postingPeriod?[0].searchValue.name

注意:我以postingPeriod为例,但是还有许多其他记录返回的"RecordRef"类型的"searchValue"也存在相同的问题.

This("searchValue.name")将为null,类似于详细的问题

This("searchValue.name") will be null, similar to the issue detailed here, but unlike with CustomFields I don't see any documented way of retrieving the lookup values based on the "internalId" of the returned "searchValue"(typically populated). To further complicate things, the returned object does not appear to have a "typeId" specified. It looks something like this:

所以我再次想知道,如何从SuiteTalk("searchValue.name")的NetSuite界面访问文本值?缺少NetSuite文档,在这种情况下,显然是类型时期" ,但是如何枚举呢?还是在这种情况下,可能有另一种方法来获取值?

So again I wonder, How do I access the text value that I can see from the NetSuite interface from SuiteTalk("searchValue.name")? NetSuite documentation is lacking, clearly in this case it's of type "period", but how does one enumerate that? Or in this case maybe there is a different way to go about retrieving the value?

我一直在环顾四周,但是关于这一点并没有写很多.我认为此处此处,没有太大帮助,我想知道是否有关于该主题的内部文档,但我没有看过,但是从我阅读的内容来看,确实是一个

I've been looking around, but there's not a whole lot written about this. I think this issue is mentioned in this post. Other than that I really can't find anything. I've already checked the API documentation, here and here, it's not much help, I wonder if there is some sort of internal documentation on the subject that I'm not seeing, but from what I've read there's really, not much.

推荐答案

我通过尝试SuiteTalk中的所有get和search方法来发现似乎是答案,告诉我找到了一种能够返回正确类型的结果的方法:

I have found what appears to be the answer by trying all the get and search methods in SuiteTalk tell I found one that was capable of returning the correct type of results:

NetSuiteService nsService = ... //Your NetSuiteService
IEnumerable<TransactionSearchRow> rows = ... //The results of your query

var lookup = nsService.getList(rows.
                Where(a => a.basic.postingPeriod.Any())
                .Select(a =>
                {
                    var value = a.basic.postingPeriod[0].searchValue;
                    value.type = RecordType.accountingPeriod;
                    value.typeSpecified = true;
                    return value;
                })
                .GroupBy(a => a.internalId)
                .Select(a => a.First())
                .ToArray()).readResponse
                .ToDictionary(a => ((AccountingPeriod)a.record).internalId, 
                    a => ((AccountingPeriod)a.record).periodName);

var allPeriods = rows
    .Select(a => a.basic.postingPeriod.Any() ? 
         lookup[a.basic.postingPeriod[0].searchValue.internalId] : "")
    .ToArray();

此方法在此处列出 ,但实际上并没有提供足够的细节.另外,我不确定为什么:

This method is listed here, but it doesn't really provided sufficient detail. Also, I'm not sure why:

Period(Column)= a.basic.postingPeriod(Property)= RecordType.accountingPeriod(Property)= AccountingPeriod(Type)

Period(Column) = a.basic.postingPeriod(Property) = RecordType.accountingPeriod(Property) = AccountingPeriod(Type)

我猜想一种也必须猜出每种类型对应什么.在一段时间内,它还不错,但对于其他一些而言,可能会有些混乱.

I guess one sort of has to guess what each type corresponds too. For period its not too bad, but for some of the other ones it can be a little confusing.

我希望这可以帮助其他人,对我来说这是一个艰难的过程.如果还有其他解决方案,我仍然欢迎您提出建议.我仍然不确定这是最有效的数据检索方法.

I hope this helps someone else out, for me its been a difficult process. If anyone else has any other solutions I'm still open to suggestions. I'm still not sure this is the most efficient method of data retrieval.

这篇关于NetSuite SuiteTalk-从"SearchColumnSelectField"检索值字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆