简体   繁体   English

NetSuite SuiteTalk-从“ SearchColumnSelectField”检索值字符串

[英]NetSuite SuiteTalk - Retrieve Value String From “SearchColumnSelectField”

Say you are trying to access a value from SuiteTalk that is returned as type "SearchColumnSelectField": 假设您正在尝试访问SuiteTalk中以“ SearchColumnSelectField”类型返回的值:

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

Note: I use postingPeriod as example, but there are many other records that return a "searchValue" of type "RecordRef" that have the same issue. 注意:我以postingPeriod为例,但是还有许多其他记录返回相同类型的“ RecordRef”类型的“ searchValue”。

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). This(“ searchValue.name”)将为null,类似于此处详述的问题,但与CustomFields不同,我看不到任何基于返回的“ searchValue”的“ internalId”检索查找值的记录方法(通常填充)。 To further complicate things, the returned object does not appear to have a "typeId" specified. 使事情更加复杂的是,返回的对象似乎没有指定“ typeId”。 It looks something like this: 看起来像这样:

在此处输入图片说明

So again I wonder, How do I access the text value that I can see from the NetSuite interface from SuiteTalk("searchValue.name")? 所以我再次想知道,如何从SuiteTalk(“ searchValue.name”)的NetSuite界面访问文本值? NetSuite documentation is lacking, clearly in this case it's of type "period" , but how does one enumerate that? 缺少NetSuite文档,在这种情况下,显然是“ period”类型的 ,但是如何枚举呢? 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 . 我已经检查过API文档, 在这里这里 ,并没有太大帮助,我想知道是否有关于我没有看到的关于该主题的内部文档,但是从我阅读的内容来看,确实没有多少

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

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. 我仍然不确定这是最有效的数据检索方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM