简体   繁体   English

Netsuite保存的搜索修剪

[英]Netsuite saved search Trim

I have a field defined in custom record as data type Rich Text. 我在自定义记录中将字段定义为数据类型为RTF。 For most of the part the data coming to that field is Text like 445F1 or 445D9, but occasionally the data comes into it as 44500 and also as '450'. 在大多数情况下,到达该字段的数据是诸如445F1或445D9之类的文本,但有时数据以44500或'450'的形式进入其中。

I created a saved search to find all the values for the field which are not 5 digits in length to give me all erroneous values like '455E1 or '455E2' which are 6 and 7 digits respectively (including the single quotes). 我创建了一个保存的搜索来查找该字段的所有长度不是5位数字的值,以便为我提供所有错误的值,例如“ 455E1”或“ 455E2”,它们分别是6位和7位数字(包括单引号)。

The problem is when the length is still 5 digits and the records are erroneous like 44500 or '450'. 问题是当长度仍然是5位并且记录是错误的(例如44500或'450')时。

To fix this I tried to create another filter in saved search as 为了解决这个问题,我尝试在另存为的搜索中创建另一个过滤器

Formula(Numeric)
To_number(Trim Both "'" From {myfield}) is greater than or equal to 1

But I keep on getting error message saying there is a syntax problem in my filter: 但是我不断收到错误消息,说我的过滤器中存在语法问题:

Your formula has an error in it. 您的公式中有错误。 It could resolve to the wrong datatype, use an unknown function, or have a syntax error. 它可能解析为错误的数据类型,使用未知函数或语法错误。 Please go back, correct the formula, and re-submit. 请返回,更正公式,然后重新提交。

What am I doing wrong? 我究竟做错了什么?

Formula(Numeric) To_number(Trim Both "'" From {myfield}) is greater than or equal to 1 公式(数字)To_number(修剪{yfield中的两个“'”)都大于或等于1

What am I doing wrong? 我究竟做错了什么?

Remember : {myfield} is not a Table. 请记住: {myfield}不是表格。 So you just can't run a query with From clause here. 因此,您无法在此处使用From子句运行查询。

To get it work you should use something like this : 要使其正常工作,您应该使用类似以下的内容:

Formula(Numeric)
LENGTH(LTRIM(RTRIM({myfield}))) not equal to 5

But this formula will failed in case the string has any character formatting.(Won't work for rich formatted text). 但是,如果字符串具有任何字符格式,则此公式将失败(不适用于富格式文本)。

I would recommend to try some other workaround in such scenario to get your job done. 我建议在这种情况下尝试其他解决方法来完成您的工作。 One possible solution would be to create a dynamic field and set a formula to calculate the length of the string. 一种可能的解决方案是创建一个动态字段并设置一个公式来计算字符串的长度。

 LENGTH(LTRIM(RTRIM({myfield})))

On the saved search you can directly search for the length and filter out erroneous data. 在保存的搜索中,您可以直接搜索长度并过滤掉错误的数据。

So I added couple of filters to achieve this. 因此,我添加了几个过滤器来实现此目的。

Formula (Text)  SUBSTR({myfield}, -1, 1) starts with '

This tell me if the last character of my field is single quote 这告诉我我字段的最后一个字符是否为单引号

Formula (Text)  SUBSTR({myfield}, 1, 1) starts with '

This tells me if the first character of my field is single quote and 这告诉我字段的第一个字符是否为单引号

Formula (Numeric) TO_NUMBER({myfield})  is greater than 100

This tells me if for some reason the instead of text I have number in my field. 这可以告诉我,由于某种原因,我的字段中是否有数字而不是文本。

It is a workaround but does the trick 这是一种解决方法,但可以解决问题

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

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