【问题标题】:Concatenate strings in powerplatform using local variable使用局部变量在powerplatform中连接字符串
【发布时间】:2021-08-18 11:59:20
【问题描述】:

我有一个从 Microsoft Forms 检索一些附件并将工作项添加到 Azure Devops 的工作流

我正在一个步骤中,我必须添加一个包含两列(名称和网址)的表格,例如:

Url 列中,我想添加超链接而不是文本,例如: <a href='....'>Click here</a>

我尝试添加concat 表达式,例如:

concat("<a href='", ..., "'>", "Click here", "</a>)
                     ^ here I don't know how to pass the link argument

如何在concat epxression 中传递link 参数?

或者如果想在列中添加超链接应该使用什么其他方法?

【问题讨论】:

    标签: power-automate power-platform


    【解决方案1】:

    您不能像我们在其他地方的 print 函数中那样在字符串中传递参数。

    但是,您可以使用replace 方法将链接放入字符串中。只要确保你的文本占位符足够奇怪,不会遇到不必要的情况。

    replace("&lt;a href='Placeholder_Text'&gt;", "Click here", "&lt;/a&gt;", 'Placeholder_Text', &lt;Your dynamic URL will go here&gt;)

    欲了解更多信息,请查看Power Automate documentation

    【讨论】:

      【解决方案2】:

      您可以使用concat 添加 URL 链接。在表达中,您只需参考正文的链接。

      创建 HTML 标签

      concat('<a href="', body()?['{Link}'], '">Short Name for link</a>')
      

      这里棘手的部分不是concat 函数,而是HTML 链接将被存储为纯文本的事实。

      您正在使用 HTML 表格,它不允许您在其中添加另一个 HTML 标签,因为它可能会破坏表格。 所以 Power Automate 会将&amp;lt; 替换为&amp;lt; || &amp;gt;&amp;gt; || "&amp;quot;

      将纯文本转换回 HTML

      因此,如果您正在寻找在某处(在电子邮件中)使用此表,您可以将这些字符替换回来,它将作为 HTML 工作。

      像这样使用嵌套的replace 表达式:

      replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')
      

      Screen: Before and After

      【讨论】:

        猜你喜欢
        • 2012-06-24
        • 1970-01-01
        • 2023-04-06
        • 1970-01-01
        • 2017-07-27
        • 2012-03-19
        • 1970-01-01
        • 2015-09-07
        • 1970-01-01
        相关资源
        最近更新 更多