如何解析具有多个字段的记录 [英] How to parse a record with multiple fields

查看:118
本文介绍了如何解析具有多个字段的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含日志条目的表。

该表有两列,第一列是时间戳,第二列包含我需要解析的数据。我要做的是将第二列中的三个字段分成三列。

以下是第二列中两行数据的示例;


(TA:606:ItemId的重复条目SerialId ModelNo [12350901] [123456086632509] [2016])

(TA:606:ItemId的重复条目SerialId ModelNo [45685470] [957125352146255] [14 ])


我对Access 2000不是太熟悉了,但是我正在尝试使用带有左右功能的instr来提取论坛。对我来说效果不好。

我认为括号是问题....

解决方案

只是为了澄清问题,在对它们运行查询后,两个数据记录应该是什么样的?


我的猜测是

12350901,123456086632509,2016

45685470,957125352146255,14

但我只猜测


像Delerna所说,我们需要看看你想要什么样的结果。此外,在下面的两个例子中


(TA:606:ItemId的重复条目SerialId ModelNo [ 12350901 ] [ 123456086632509 ] [2016])

(TA:606:ItemId SerialId ModelNo重复输入[ 45685470 ] [ 957125352146255 ] [14])


是hilited字段总是长度相同的字符数或者它们是否有所不同?


欢迎来到TheScripts!


Linq ; 0)>



我有一个包含日志条目的表。

该表有两列,第一列是时间戳,第二列包含我需要解析的数据。我要做的是将第二列中的三个字段分成三列。

以下是第二列中两行数据的示例;


(TA:606:ItemId的重复条目SerialId ModelNo [12350901] [123456086632509] [2016])

(TA:606:ItemId的重复条目SerialId ModelNo [45685470] [957125352146255] [14 ])


我对Access 2000不是太熟悉了,但是我正在尝试使用带有左右功能的instr来提取论坛。对我来说效果不好。

我认为括号是问题....



只要数据要解析的内容仍然在括号([])中,并且在数据元素之间和第三个元素的末尾存在单个空格,那么它就变得相当简单。假设第二列位于名为[Field_Test]的字段中,该字段位于名为tblTest的表中,则它将成为一个带有三个计算字段的查询,调用3个简单函数:

展开 | 选择 | Wrap | 行号

I have a table that contains log entries.
The table has two columns, the first column is a timestamp and the second column contains the data I need to parse. What I have to do is seperate the three fields in the second column into three columns.
Here is an example of two rows of data from the second column;

(TA:606:Duplicate Entry For ItemId SerialId ModelNo [12350901] [123456086632509] [2016] )
(TA:606:Duplicate Entry For ItemId SerialId ModelNo [45685470] [957125352146255] [14] )

I am not too familiar with Access 2000 but reviewing the forums I attempted to use instr with left and right functions to extract. Didn''t work too well for me.
I think the brackets were the problem....

解决方案

just to clarify the question, what should the two records of data look like after running the query on them?

my guess is
12350901,123456086632509,2016
45685470,957125352146255,14

but im only guessing


Like Delerna said, we need to see what kind of results you want. Also, in the two examples below

(TA:606:Duplicate Entry For ItemId SerialId ModelNo [12350901] [123456086632509] [2016] )
(TA:606:Duplicate Entry For ItemId SerialId ModelNo [45685470] [957125352146255] [14] )

are the hilited fields always the same number of characters in length or do they vary?

Welcome to TheScripts!

Linq ;0)>


I have a table that contains log entries.
The table has two columns, the first column is a timestamp and the second column contains the data I need to parse. What I have to do is seperate the three fields in the second column into three columns.
Here is an example of two rows of data from the second column;

(TA:606:Duplicate Entry For ItemId SerialId ModelNo [12350901] [123456086632509] [2016] )
(TA:606:Duplicate Entry For ItemId SerialId ModelNo [45685470] [957125352146255] [14] )

I am not too familiar with Access 2000 but reviewing the forums I attempted to use instr with left and right functions to extract. Didn''t work too well for me.
I think the brackets were the problem....

As long as the data to be parsed remains within brackets ([ ]), and a single space exists between the data elements and at the end of the 3rd element, then it becomes a fairly simple matter. Assuming the 2nd Column is in a Field named [Field_Test], which is in a Table named tblTest, then it becomes a Query with three Calculated Fields calling 3 simple Functions:

Expand|Select|Wrap|Line Numbers


这篇关于如何解析具有多个字段的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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