Populate a Rich TextBox from Filtered data - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Populate a Rich TextBox from Filtered data

Last post 02-20-2009 08:11 PM by doctorcpu. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 02-19-2009 05:07 PM

    Populate a Rich TextBox from Filtered data

    Hi,

     

    I'm new to the forum and have searhed for help although I may not be using the correct key words to get help.  I have a SQL view on my SQL 2005 server in which I've setup as a secondary connection to my form.  On the form I have a Rich textBox in which I would like all data from the Items field displayed one line each.  I don't know if this is possible.  My idea was to populate the textbox so that items can be added or removed as part of the final process and I don't think this can be done for a listbox.  Any help with this or any ideas of a better way of doing this is appreciated.  Alos, I'm a VB programmer but InfoPath is somewhat confusing from a programming stand point, so can you recommend the best resorce for programming using VB in InfoPath?

     

    Thanks

  • 02-19-2009 08:48 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    It sounds like what you want to do might be better suited for a repeating table or repeating section, rather than a rich text box.  These controls can easily have rows removed from them more cleanly than a text control can.

     Programming in InfoPath can be confusing at first, but it is really little more than XML manipulation, so if you are good at that, InfoPath should not be too hard to get into.

    I have a post on this forum that involves copying data from a secondary (SQL) data source to the main data source in C# and JScript
    http://www.infopathdev.com/forums/p/9471/33560.aspx#33560

    If you know enough about either of those languages to figure out how to do the same stuff in VB it might help get you started.  If not, I'd be happy to show you an example in VB.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-19-2009 09:10 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    Jimmy,

     

    Thanks for the reply.  I looked as you recommended but I really don't have a clue when it comes to C#, XML, or JScript.  Everything I read indicates you can use VB in InfoPath but it sounds like I need a quick class in XML. :) Can you add as well as delete in a repaeating table?  When I try the properties of the repeating table and choose the secondary connection the error I get is that its not a repeating field or something like that so the next button won't ungrey.  I will see if I can find something to cross reference you code into VB.  If you have or can point me to an example in VB that would be great.

     

    Again thanks for the reply.

  • 02-19-2009 09:30 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    A repeating section must be bound to a repeating group or field in the data source.  This is indicated in a data source tree by an icon (either a folder icon or a piece of paper icon) with a blue rectangle and a white arrow pointing downwards.  Try expanding the nodes in the secondary data source and looking for an icon like this (it will probably be under the dataFields group.

     Could you describe with a little more detail what exactly you want your form to do?  You can bind a repeating table to your secondary data source, but the problem with this is that when you save the form, the data in that table will not be saved.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-19-2009 09:40 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    I'm trying to create a form that does the following:

    When I enter a part number in a field or select from a dropdown field displays the results of a field from the sql view.  I'm using a view because I found that in a book I purchased.  I have a SQL Query that will return all rows either filtered or unfiltered.  I'd like to enter the part number and get the results of allcross refernece part numbers in the database but be able to insert or remove htem from the form before saving the form or printing the form.  It would be nice to save the form for future refreence however.  In VB I could just make the SQL Connection, create a table and filter the table and assign the results to any control, but as I understand things in InfoPath that's not the case.  I thought I could just write something that would copy the results of a filed from the query results to a textbox control and save the form as a differnet file name for future reference.  I hope this makes since.

     

    Thanks again

  • 02-19-2009 10:51 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    Ok, it sounds like your requirements might call for copying the data from your secondary data source to the main data source, and then showing that data in a repeating section, where it can be modified by the form user.

     Here are the steps you could take to accomplish this:

    1. Create a repeating group in your data source with  a similar structure to the dataFields group in your secondary data source.  Please see the following post for a little detail on that
      http://www.infopathdev.com/forums/p/9471/33560.aspx#33560
    2. Then use some code to copy values from the secondary data source to the group you have created in the main data source.  You can use the CopyResults() subroutine in this post as a reference
      http://www.infopathdev.com/forums/p/9471/38671.aspx#38671

    Those two steps are not altogether simple, so please follow them as well as you can, and let me know if you need me to break it down with any more detail.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-19-2009 11:08 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    Great, Thanks Again.

    Do you have an example of this in which I could step through the code and watch the results line by line?  I'll work with this tomorrow.  I'm not sure if InfoPath will let you as Visual Basic will as for as stepping through each line of code.

     

    Again I do appreciate your help with this.

     

    thanks 

     

  • 02-19-2009 11:41 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    Sure, here you go.

    Please extract the .zip to somewhere on your computer and open the XSN in design mode.  Press Alt+Shift+F12 to open up VSTA.  It may give you an error about not being able to locate the code project.  Please direct it to where you extracted the .vbproj file.

    Then if you start debugging (F5) the form will open in preview mode.  You can set breakpoints and then click Copy on the form to start the code running.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-20-2009 08:11 PM In reply to

    Re: Populate a Rich TextBox from Filtered data

    Thanks,

    Excellent example.  I managed to get everything to work but have a few new questions which hopefuly you can help me with.

     Can the first table be a ComboBox so that it only show unique vaules?  If so can the repeating table below it return the results of all records of a field based on the filed selected in the ComboBox?

    Can the header be changed to show the item selected in the combobox?

    If not can the first repeating table be hidden?

    Can you recommend any good books or videos to purchase?

     

    Thanks again

     

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.