如何从字符串中提取部分以创建集合

发布于 2025-01-17 00:51:29 字数 1799 浏览 5 评论 0原文

我从图库字段 (galMyData.Selected.People) 中获取了一个字符串,其格式为 -

lastName1, firstName1 ([email protected]) - Dept1 Dept2 Dept3  ; lastName2, firstName2 ([email protected]) - Dept1 Dept3 ; lastName3, firstName3 ([email protected]) - Dept1 Dept4  

我可以拆分该字符串并使用以下命令创建一个表 -

ClearCollect(
    SelectedPeople, 
        Split(galMyData.Selected.People, " ; ") 
)

这会生成一个集合,其中所有这些都在

lastName1, firstName1 ([email protected]) - Dept1 Dept2 Dept3  
lastName2, firstName2 ([email protected]) - Dept1 Dept3 
lastName3, firstName3 ([email protected]) - Dept2 Dept4 

我想要创建的 单个列中一个新的集合将其分为不同的列。即

(header)LastName FirstName FullName Email Dept1 Dept2 Dept3 Dept4
lastName firstName "lastName, firstName" [email protected] true true true false

(我不需要标题,但我将其包含在内以进行说明) 我真的不知道如何分离字段来创建新的集合。

任何指导将不胜感激。

I've got a string from a gallery field (galMyData.Selected.People) in the format-

lastName1, firstName1 ([email protected]) - Dept1 Dept2 Dept3  ; lastName2, firstName2 ([email protected]) - Dept1 Dept3 ; lastName3, firstName3 ([email protected]) - Dept1 Dept4  

I can split the string and create a table using-

ClearCollect(
    SelectedPeople, 
        Split(galMyData.Selected.People, " ; ") 
)

This yields a collection with all of this in a single column

lastName1, firstName1 ([email protected]) - Dept1 Dept2 Dept3  
lastName2, firstName2 ([email protected]) - Dept1 Dept3 
lastName3, firstName3 ([email protected]) - Dept2 Dept4 

I'd like to create a new collection separating this out into distinct columns. i.e.

(header)LastName FirstName FullName Email Dept1 Dept2 Dept3 Dept4
lastName firstName "lastName, firstName" [email protected] true true true false

(I don't need the header but I'm including it for illustration)
I'm really not sure how to separate out the fields to create a new collection.

Any guidance would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尾戒 2025-01-24 00:51:30

对于任何追踪此问题的人,我使用此实现了它-

ForAll(
    Split(galMyData.Selected.People, " ; "), 
    Collect(reWorkedData,{
        investor: First(Split(Result, " ; " )).Result, 
        lName: First(Left(Split(Result, " ; " ), Find(", ", Result)-1)).Result, 
        fName: First(Mid(Split(Result, " ; " ),  Find(", ", Result)+2, (Find(" (", Result)-(Find(", ", Result)+2)))).Result , 
        eMail: First(Mid(Split(Result, " ; " ),  Find("(", Result)+1, (Find(")", Result)-(Find("(", Result)+1)))).Result 
        }
    )
);

For anyone tracking this, I achieved it using this-

ForAll(
    Split(galMyData.Selected.People, " ; "), 
    Collect(reWorkedData,{
        investor: First(Split(Result, " ; " )).Result, 
        lName: First(Left(Split(Result, " ; " ), Find(", ", Result)-1)).Result, 
        fName: First(Mid(Split(Result, " ; " ),  Find(", ", Result)+2, (Find(" (", Result)-(Find(", ", Result)+2)))).Result , 
        eMail: First(Mid(Split(Result, " ; " ),  Find("(", Result)+1, (Find(")", Result)-(Find("(", Result)+1)))).Result 
        }
    )
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文