1

How to pre-fill new fields in a InfoPath form base on the old fields, when I add a fields to a form.

In my InfoPath form I have a field name called: "Description". Now I added another field called: "SummaryDescription". Which is suppose to take the first 10 words from the Description field.

Even though I added field and the logic, the existing form data in SharePoint Database does not get modified.


Edit

@PatrickPitre

Thank you very much for the quick response.

I'm dealing with a web-based InfoPath form (Forms Services). Yes I do have Visual Studio 2008 installed in my computer.

One of the things I need to do is to modify existing web-based InfoPath form, which is to add three more fields to the old one. Once I add the fields I need to make sure those newly added fields are not blank when the user click on the existing form that is already in the Sharepoint. I have to take the first 200 words in the existing field say "Description" and plug it into the new field "SummaryDescription".

What I have done so far:

  1. I added those three new fields to the web-based InfoPath form and published into one the test server. I'm able to view the newly added fields in the existing form.

  2. I'm trying to use the Rule in the InfoPath to help me achieve what I need to do. I check whether or not the newly added fields are blank or not. If it is then take the fields in "SummaryDescription" and add the value of .

This is the code:

concat(
substring((string-length(Description)), 1, ((string-length(Description)) <= 200) * (string-length(Description))), 
substring(number(201), 1, (not(string-length(Description))) * number(201))
) 

But I'm not able to add the value to the field at all.

This is the screen shot of what I did.

enter image description here

I have tried many different ways. And I'm pretty sure "SummaryDescription" is blank but I just could not get the value to display

What do I mean by "Sharepoint Database"? I thought that everything in the web-based InfoPath form is store in some kind of Database. Correct me if I'm wrong.

Thank you very much.

yyc2001
  • 113
  • 2
  • 15
  • 1
    How do you feel about VSTO, and getting your hands dirty with some C# code? – Patrick Pitre Dec 20 '11 at 05:26
  • @PatrickPitre I'm willing to get my hands dirty with C# code. As long as I'm able to update the fields. I'm quite new at Sharepoint. I would appreciate if you can lead me to the right direction. – yyc2001 Dec 20 '11 at 06:11
  • 1
    Okay, so first: are you dealing with the InfoPath client itself, or a web-based InfoPath form (Forms Services)? Secondly, do you have Visual Studio installed (VS 2008, best-case, but VS 2010 will work too). Also, can you explain what you've done thus far a little better? Also also, what do you mean by "SharePoint database"? – Patrick Pitre Dec 20 '11 at 06:28
  • @PatricPitre Thank you very much for the quick response. My answer is in the edit section of this forum. Thank you again for the help. If you need more information I will do my best to provide it to you. – yyc2001 Dec 20 '11 at 17:07

1 Answers1

0

Just by extending the schema and logic of an InfoPath form doesn't mean any pre-existing data (filled forms) will be automagically upgraded.

You have several options

  • Process the existing XML forms with XSLT or a custom upgrade application to transform the XML;
  • Make use of the VersionUpgrade event in the form's code-behind to perform any upgrade steps.

The principal difference is that in the first case you can make a batch upgrade, while in the latter case it's case-by-case on-demand upon opening an existing form.

Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
  • Thank you for the response. I'm very new at Sharepoint and InfoPath. If I process the existing XML forms with XSLT, how do I put the modify form back to Sharepoint. What I mean is that I know how to extract all the form out of Sharepoint but I'm not too sure how to put it back. – yyc2001 Dec 22 '11 at 03:59