字符串的备注字段FND第二occourance [英] Fnd 2nd occourance of a string in a Memo Field

查看:340
本文介绍了字符串的备注字段FND第二occourance的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为工作日志备注字段。 我的表名是:MissingT。 我想运行它可以找到一个特定的字符串,并获得下一个6位数以下的特定字符串的查询。

该字符串看起来象下面这样:

 状态:工作进展
 提交时间:2014年12月5日 - 上午08点44分53秒EST
 审批状态:已批准
 批准日期:2014年12月5日 - 上午8点44分53秒EST
 
 第1节 -  REQUESTER简介
 用户名:xxx111
 名称:有的,名称
 电话号码:999-999-999
 地区:
 
 第2节 - 授权的个人简介
 用户名:xxx222
 名称:有的,名称2
 电话号码:999-999-9999
 标题:Manager
 

我想查询以获得用户ID根据第2,我现在的查询查找用户ID根据第1条,并得到6串下它(xxx111)。我怎样才能将查询得到的字符串用户名和6串下面是第二个发生。

 更新MissingT SET MissingT.AuthManager = MID([工作日志](INSTR([工作日志],用户名:)+8),7)
WHERE(((MissingT [工作日志]),如*和放大器;'用户名:'&放大器;*));
 

解决方案

我不是100%确定如何有效的,这可能是,但我建议你有一个发挥作用的与此有关。

 更新
    MissingT
组
    MissingT.AuthManager = SplSplit([工作日志],用户名:,1,7)
哪里
    。MissingT [工作日志]类似于*用户ID:*;
 

该SplSplit是一个UDF,这是一样的东西,

 公共功能SplSplit(inpStr作为字符串_
                         FINDSTR作为字符串_
                         殷钢作为整数,_
                         lenVar作为整数)

    SplSplit =左(斯普利特(inpStr,FINDSTR)(殷钢),lenVar)

    如果你希望它是一款基于然后将其更改为以下。
    SplSplit =左(斯普利特(inpStr,FINDSTR)(殷钢+ 1),lenVar)
端功能
 

inpStr 是你传递的备注字符串, FINDSTR 是您要使用它分解成多个部分的字符串淅沥,殷钢是您正在寻找的数据的位置,最后的 lenVar 是你需要收集的长度。

注意:殷钢仍然是零基础的,如果你想要一个基础,然后更改殷钢作为因瓦合金+ 1 在$ C $℃。

分割功能将打破巨大的备注字段成更小的数据块,基于标识符,在您的案件用户名:。由于我们只关心第二个用户ID,只需使用该索引(如分离得到的分割数据从零开始的数组)。

正确的解决方案,但是,会忘记这个可怕的备注字段,并创建相应的状态code和领域日志表。

I have a memo field called "Worklog". My table name is: MissingT. I would like to run a query which can find a specific string and get the next 6 digits following that specific string.

The string would look like below:

Status: Work in Progress
 Submitted: December 5, 2014 - 8:44:53 AM EST
 Approval Status: Approved
 Date Approved: December 5, 2014 - 8:44:53 AM EST
  
 SECTION 1 - REQUESTER PROFILE
 User ID: xxx111
 Name: Some, Name
 Phone #: 999-999-999
 Region: Canada
  
 SECTION 2 - AUTHORIZED INDIVIDUAL PROFILE
 User ID: xxx222
 Name: Some, name2
 Phone #:999-999-9999
 Title: Manager

I want the query to get the user id under section 2. My current query finds the User ID under section 1 and gets the 6 strings following it (xxx111). How can I move the query to get the 2nd occurrence of string "User ID" and the 6 strings following it.

UPDATE MissingT SET MissingT.AuthManager = mid([Worklog],(InStr([Worklog],'User ID: ')+8),7)
WHERE (((MissingT.[worklog]) Like  "*" & 'User ID:' & "*"  ));

解决方案

I am not 100% sure how efficient this could be, however I would suggest you to have a play around with this.

UPDATE 
    MissingT 
SET 
    MissingT.AuthManager = SplSplit([Worklog], 'User ID: ', 1, 7)
WHERE 
    MissingT.[worklog] Like  "*User ID:*";

The SplSplit is a UDF, which is something like,

Public Function SplSplit(inpStr As String, _
                         findStr As String, _
                         inVar As Integer, _
                         lenVar As Integer)

    SplSplit = Left(Split(inpStr, findStr)(inVar), lenVar)

    'If you want it to be ONE based then change it to the following. 
    'SplSplit = Left(Split(inpStr, findStr)(inVar+1), lenVar)'
End Function

inpStr is the Memo String you pass, findStr is the string patter you want to use to break it into multiple sections, inVar is the location of the data you are looking for, finally lenVar is the length you need to collect.

NOTE: The inVar is still ZERO based, if you want ONE based, then change the inVar as inVar + 1 in the code.

The Split function will break the huge memo field into smaller chunks of data, based on the identifier, in your case 'User ID: '. Since we are only concerned about the second User ID, we simply use that index (as Split give a zero based array of split data).

The correct solution however; would be to forget about this horrendous Memo field and create a log table with appropriate status code and fields.

这篇关于字符串的备注字段FND第二occourance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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