Edit null fields in a InfoPath form - InfoPath Dev
in

InfoPath Dev

Edit null fields in a InfoPath form

Last post 06-21-2006 04:25 PM by Matt Faus. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-19-2006 01:35 AM

    • Johny
    • Not Ranked
    • Joined on 06-19-2006
    • Posts 3

    Edit null fields in a InfoPath form

    I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as empty elements in the XML to can edit the field in InfoPath.

    If the field isn't present in XML I can't edit it in InfoPath.

    I have this code:

    this.t_ARQUEOTableAdapter.Fill(this.tArqueo.T_ARQUEO);
    string myForm = @"C:\Documents and Settings\Johny\My documents\Visual Studio 2005\Projects\Arqueo\IP_tArqueo\manifest.xsf";
    System.IO.MemoryStream stream1 = new System.IO.MemoryStream();
    tArqueo.WriteXml(stream1);
    fcInfoPath.NewFromFormTemplate(myForm, stream1, XmlFormOpenMode.Default);


    Where fcInfoPath is a Microsoft.Office.InfoPath.FormControl

    How to do that ?

    Thank you very much
    Johny
  • 06-20-2006 07:26 PM In reply to

    Re: Edit null fields in a InfoPath form

    What is doing the serialization from the DB into the XML? I think this should not be elimnating the nodes from the schema, but just doing a /> ending to the element. I would check into fixing it at the serialization side, but if you can't do that you can write code in the form that looks for these missing nodes and adds them in with a blank value so that you can edit them.

    I hope this helps, let us know how it goes and if have any other questions feel free.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-20-2006 11:31 PM In reply to

    • Johny
    • Not Ranked
    • Joined on 06-19-2006
    • Posts 3

    Re: Edit null fields in a InfoPath form

    quote:
    Originally posted by Matt Faus

    but if you can't do that you can write code in the form that looks for these missing nodes and adds them in with a blank value so that you can edit them.

    I hope this helps, let us know how it goes and if have any other questions feel free.


    Thank you very much, I will do it. I think that is the best solution

    Greetings
  • 06-21-2006 06:39 AM In reply to

    • Johny
    • Not Ranked
    • Joined on 06-19-2006
    • Posts 3

    Re: Edit null fields in a InfoPath form

    Hi Matt Faus,
    I have found this solution:
    - First of all, I do a clone from tArqueo dataset (tArqueoString)
    - Next, I convert all of columns from tArqueoString to string
    - Now, I fill tArqueo dataset with the adapter
    - Finally, I cross the tArqueo dataset row by row and I add a new row to tArqueoString. For each column, I copy its values. In case of numbers, I use Convert.ToString with NumberFormatInfo as provider. In case of dates, I use date1.ToString(dtfi.SortableDateTimePattern) when dtfi is a DateTimeFormatInfo.

    With this solution I "deceive" to WriteXml method
  • 06-21-2006 04:25 PM In reply to

    Re: Edit null fields in a InfoPath form

    Sounds like an awesome workaround, I'm glad you figured it out!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.