您现在的位置: 爱51代码网 >> 范文 >> 文章正文
infopath里面用concat连接字符,如何换行

infopath里面用concat连接字符,如何换行

concat("A", "CHAR(13)", " B ",)
concat("A", "\n\r", " B ",)
concat("A", "</br>", " B ",)

都试过了,都不行啊;我需要的效果是:
A
B

One method for persisting data in a SharePoint environment is the use of Infopath forms. Infopath stores data in your form in XML format. I have a form which has a “comments” box where people add new comments as they progressively update the form and a “consolidate comments” box which shows all previous comments*. However, Infopath forms don’t natively support appending new data to existing data – and new comments added may blow away any previous comments.

It’s relatively trivial to enable this functionality. Assume you have your two comment boxes

comments_add – blank comment box for adding new comments
comments_display – shows all historical comments, and is bound to your “comments” field in your data connection
button_submit – submits the form to the server, will currently have rules, e.g., “submit using data connection”, “close form”

To add new comments to old comments, you need to add a rule to your button, before the data is submitted. The rule will “set a field’s value” and use the concat function to concatenate the two comments boxes together. In the value section, Insert Formula and have, e.g

concat(comments,comments2)
In this case I set the value of my local “comments” field to the value of “ows_comments” (in my data connection) + the value of my new comments box. When you submit this, your comments box will contain both values. However, you will notice that the display is not very nice. You could concat a space in between the fields, but a newline between comments would be preferable. This is not quite as simple as it sounds, however, as Infopath controls don’t seem to accept the standard newline chars (e.g., \r\n). There is a way, however:

1. Create a new XML file and fill it with

<?xml version “1.0″ >
<linebreaks>
<newLine>&#xA;</newLine>
</linebreaks>
2. Add it as a resource and data connection to your form
3. In your Concat function, reference it:

concat(comments1, newLine,comments2)
4. Ensure your textbox is multi-line enabled (Click Textbox > Control Tools > Control Properties)

And that should work. I had screenshots of the process, but it seems an overzealous host admin has gone crazy with mod_security2 and killing anything that tries to add an equals sign to a post.

  • 上一篇文章:

  • 下一篇文章: 没有了
  • 最新文章 热点文章 相关文章
    lotus数据列表文档个数如何实时统
    lotus代理中LS如何将字符串保存到
    在lotus BS系统里怎样方便实现统
    undefined reference timer_crea
    linux文件/usr/lib破坏了,还原后
    linux上运行system函数时,print
    Failed to open eth0
    android手机无法与eclipse或电脑
    C/C++洗牌算法源代码
    servlet技术实现用户名唯一的验证
    undefined reference timer_crea
    Failed to open eth0
    ZOJ 3700 Ever Dream 文章中单词
    TortoiseGit和msysGit安装及使用
    sharepoint 2010 获取用户信息Us
    mysql主从同步延迟方案解决的学习
    生日旅行总结
    中小板生日快乐随感
    送生日快乐桑葚乳酪小蛋糕
    写给女儿的生日快乐
    MQ集群同步响应消息返回问题
    SharePoint的WebPart和Timer
     



    设为首页 | 加入收藏 | 网站地图 | 友情链接 |