简体   繁体   English

sql(报告服务)字段拆分并查找

[英]sql (reporting services) field split and find

i have a field, wich contains an adress with comma separations like: always some code and then description 我有一个字段,其中包含用逗号分隔的地址,例如:总是有一些代码,然后再进行描述

"19415 - City" (different city has a different code) "ABTH - sites" (always 4 digits and have a "TH" in the end, only the first 2 letters change) "ABCD - building" (always 4 different letters) and more place describing data, but those are not required “ 19415-城市”(不同的城市具有不同的代码)“ ABTH-站点”(始终为4位数字,并且末尾带有“ TH”,只有前2个字母更改)“ ABCD-建筑”(始终为4个不同字母)和更多描述数据的地方,但这些不是必需的

in the query i can split into 3 columns with 在查询中,我可以分为三列

=fields!A_hiba_helye.Value.split(",")(0) and in the column i change the (0) to (1) or (2) =fields!A_hiba_helye.Value.split(",")(0)然后在列中将(0)更改为(1)(2)

but the input is mixed up in some cases 但在某些情况下,输入会混淆

thanks 谢谢

managed to solve the problem. 设法解决了问题。 for the cities i used InStr just like above, and for the sites and buildings i used iif s: sor the sites: 对于我像上面一样使用InStr的城市,以及对于我使用过iif s的站点和建筑物:sor这些站点:

=iif(fields!A_hiba_helye.Value.split(",")(0).contains("TH"), fields!A_hiba_helye.Value.split(",")(0),
(iif(fields!A_hiba_helye.Value.split(",")(1).contains("TH"), fields!A_hiba_helye.Value.split(",")(1), fields!A_hiba_helye.Value.split(",")(2) )) )

and for the buildings: 对于建筑物:

=iif(fields!A_hiba_helye.Value.split(",")(0).contains("TH") Or (fields!A_hiba_helye.Value.split(",")(1).contains("TH")),
fields!A_hiba_helye.Value.split(",")(2),
(iif(fields!A_hiba_helye.Value.split(",")(1).contains("TH"), fields!A_hiba_helye.Value.split(",")(2), fields!A_hiba_helye.Value.split(",")(1) )) )

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

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