将删除并替换在MS SQL报告构建器中

发布于 2025-02-01 07:45:58 字数 500 浏览 3 评论 0原文

一个字段给我以下字符串:

#$ texta#$ textb#$ textc

我想删除#$ - chars,然后通过新行将值分开。此外,我想替换特殊字符(&)。最后看起来应该像这样:

texta
textb
textc

因此我使用此代码:

=Replace(Replace(Fields!My_Field.Value,"&","&"),"#$",Environment.NewLine)

字符串以#$开头,因此此代码在开始时就制作了一条新行,我想通过使用此代码避免使用:

=Right(First(Fields!My_Field.Value, "DATASET"), Len(First(Fields!My_Field.Value, "DATASET"))-2)

我想在 >替换功能开始。我的问题是,我不知道如何结合这两个功能以正常工作。

A field gives me the following string:

#$TEXTA#$TEXTB#$TEXTC

I want to remove the #$-chars and seperate the values by a new line. In addition I want to replace special characters (&). In the end it should look like this:

TEXTA
TEXTB
TEXTC

So I use this code:

=Replace(Replace(Fields!My_Field.Value,"&","&"),"#
quot;,Environment.NewLine)

The string starts with #$, so this code makes a new line in the beginning, which I want to avoid by using this code:

=Right(First(Fields!My_Field.Value, "DATASET"), Len(First(Fields!My_Field.Value, "DATASET"))-2)

I want to remove the first two chars before the replace function starts. My problem is, that I dont know how to combine these two functions to work properly.

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

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

发布评论

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

评论(1

白龙吟 2025-02-08 07:45:58

没有测试此问题。...

我认为您应该能够用第二个表达式在第一个表达式中替换对第一个表达式中对该字段的参考。

=Replace(
        Replace(
               Right(First(Fields!My_Field.Value, "DATASET"), Len(First(Fields!My_Field.Value, "DATASET"))-2)
               ,"&"
               ,"&"
        ),
        "#$",
        Environment.NewLine
        )

Without testing this....

I think you should just be able to replace your reference to the field in your first expression, with your second expression, like this.

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