Hi all,
I'm seeing an interesting behavior in InfoPath that I want to get around. I used my own schema to build the template on. I have some xml data already around that I will need to convert to valid InfoPath data. The XML I need to convert follows the schema. I intend to just add the PI's at the top of each file.
I have noticed that InfoPath likes ALL attributes to exist in its data. It doesn't seem to matter if it's optional or not required. InfoPath includes all attributes (some empty if appropriate) unlike some of my raw data. The producers of my raw data typically only added an attribute if the attribute was to have a value. So their data omits a lot of attributes mentioned in the schema. (they are optional, after all)
I find that if I try to open one of these "converted" forms (PI's added), if any attributes were missing, they can't be edited in InfoPath. For repeating data, such as a table, you can't select the missing field, although it appears blank. If you add a new row, you can edit the field in the new row -- it's just in the old row that lacked the attribute that you can't change it. For non-repeating data, (I've seen a checkbox like this) it is grayed out, and you can't change it.
I tried to reproduce this with an editable schema (built using InfoPath). I created a form, saved a data that uses the form, and then added some attributes. It didn't have the problem. It added the attributes for me. It seems like it's only when you use your own schema that the problem occurs.
Has anybody seen this behavior, and what have you done to get around it? I've considered preprocessing the data to add missing fields (as part of the conversion to Infopath) and I'm considering writing an OnVersionUpgrade event too (I did get that to work, but it's not pretty).
If I can't get InfoPath to do it for me, my next favorite idea would be to write an OnVersionUpgrade that somehow compared the doc to the schema and added all attributes that the doc lacked. This is well beyond my present experience, so I thought I'd ask here before I try that to make sure I haven't missed something.
thanks
Joe