ssrs 表达式可以分割字符串吗?

发布于 2024-11-27 17:52:43 字数 216 浏览 1 评论 0原文

所以在我的查询中,我有 select columnx from tblz

它返回 001.255556.84546

我希望能够通过“.”来分割它并将其分成三列。

column1 = 001
column2 = 255556
column3 = 84576

这可能吗?

so in my query i have select columnx from tblz

it returns 001.255556.84546

I want to be able to split this via '.' and put it into three columns.

column1 = 001
column2 = 255556
column3 = 84576

is this possible?

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

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

发布评论

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

评论(4

风渺 2024-12-04 17:52:43

仅供参考,在 2008 年这些不起作用,您必须执行以下操作:

=Split(Fields!returnedValue.Value, ".").GetValue(0)

For info, in 2008 these dont work, you have to do the following:

=Split(Fields!returnedValue.Value, ".").GetValue(0)
写给空气的情书 2024-12-04 17:52:43

使用以下表达式创建三个计算字段:

=(Split(Fields!columnx.Value, ".")).GetValue(0)
=(Split(Fields!columnx.Value, ".")).GetValue(1)
=(Split(Fields!columnx.Value, ".")).GetValue(2)

我不确定它是否有效,也许可以尝试一下。您可能需要在获取值之前使用 IIF() 语句来检查值。

Create three calculated fields with the following expressions:

=(Split(Fields!columnx.Value, ".")).GetValue(0)
=(Split(Fields!columnx.Value, ".")).GetValue(1)
=(Split(Fields!columnx.Value, ".")).GetValue(2)

I'm not sure it works or not, maybe give it a try. You might need to use IIF() statement to check values before getting them.

划一舟意中人 2024-12-04 17:52:43

在 SSRS 中,您引用字段名称,告诉它要使用的分隔符。由于您本身没有分配给变量,因此您需要告诉它要使用分割字符串的哪一部分。在您的示例中,

=Split(Fields!returnedValue.Value,".")(0)
=Split(Fields!returnedValue.Value,".")(1)
=Split(Fields!returnedValue.Value,".")(2)

您可以将 returnedValue 替换为实际字段名称,并将其中每一者分别放入您的第 1 - 3 列中。

In SSRS you reference the field name, tell it the delimiter to use. Since you are not assigning to a variable, per se, you then need to tell it which part of the split string to use. In your example

=Split(Fields!returnedValue.Value,".")(0)
=Split(Fields!returnedValue.Value,".")(1)
=Split(Fields!returnedValue.Value,".")(2)

You would replace returnedValue with whatever the actual field name is, and place each one of those into your columns 1 - 3, respectively.

醉态萌生 2024-12-04 17:52:43

该答案最初发布在问题中,而不是作为答案发布:

=(Split(Fields!columnx.Value,".")).GetValue(0)
=(Split(Fields!columnx.Value,".")).GetValue(1)
=(Split(Fields!columnx.Value,".")).GetValue(2)

This answer was originally posted in the question instead of being posted as an answer:

=(Split(Fields!columnx.Value,".")).GetValue(0)
=(Split(Fields!columnx.Value,".")).GetValue(1)
=(Split(Fields!columnx.Value,".")).GetValue(2)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文