Populate checkbox from Sharepoint List - InfoPath Dev
in

InfoPath Dev

Qdabra® Active Directory Web Service

Use our Google Custom Search for best site search results.

Populate checkbox from Sharepoint List

Last post 11-15-2010 04:39 AM by chris.de.simpele. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 09-03-2010 07:56 AM

    • Bexx27
    • Not Ranked
      Female
    • Joined on 09-03-2010
    • Posts 6

    Populate checkbox from Sharepoint List

    Help Please!

    I have just started using Infopath 2007 so I can generate a bit of a search on a Sharepoint list. I setup my list so that some of the fields are yes/no checkboxes. I have added the list as a datasource to received data and this has been working for me on all of the fields that are textboxes. I am using conditionals to basically filter the list to show only those conditions which match the search. I formatted the repeating section so that details about the items being search will be displayed. Some of these details I wanted to show as a check on/off box to denote if the item has that feature.

    The problem that I am having is that all of the checkboxes display as blank. When I change the checkbox to a textbox and run my search the boxes display a value of 1 or 0 so I know that the data source is received data properly. I am assuming that I am missing something when it comes to the checkboxes.

     What do I need to do to have the true/false data displayed in a populated checkbox?  Any help would be appreciated it.

    Thanks,

     Bex

    Addition: All I am doing to add the checkbox is drag the attribute from the secondary data source (Sharepoint List). It makes the box automatically.

  • 09-03-2010 11:23 AM In reply to

    Re: Populate checkbox from Sharepoint List

    Are you able to change the checked / unchecked values for the checkbox controls? It seems odd that if the boxes are bound to your secondary data source that they aren't being created with the correct values... but if you can change them you could set checked to be 1 and unchecked to be 0.

    Hilary Stoupa

  • 09-03-2010 12:32 PM In reply to

    • Bexx27
    • Not Ranked
      Female
    • Joined on 09-03-2010
    • Posts 6

    Re: Populate checkbox from Sharepoint List

     I am not able to change the values it is greyed out. I wanted to change it to 1 and 0 because that is what was printing in the textbox. I am assuming it won't let me change it because it was generated from the 2nd data source.

  • 09-03-2010 12:39 PM In reply to

    Re: Populate checkbox from Sharepoint List

    Yah, that's kind of what I was thinking was going to happen. If you have a checkbox bound to one of these fields, and also a text box (so you can see the actual value) and you preview and select the checkbox, what does the actual value show? What about when you de-select?

    Hilary Stoupa

  • 09-03-2010 12:39 PM In reply to

    • Bexx27
    • Not Ranked
      Female
    • Joined on 09-03-2010
    • Posts 6

    Re: Populate checkbox from Sharepoint List

     Interestingly. I just tried created a new Sharepoint column that was specified as a number. I then set the min = 0 and the max = 1 as a constraint on the column. When I made that column into a checkbox it worked just fine.The number checkbox had checked = 1 and unchecked = 0.

    I am wondering if the yes/no checkboxes are not populating because their real values are yes and no.. at least thats what it says in Sharepoint.  It is confusing because in Infopath clearly states its data type to be boolean.

  • 09-03-2010 12:49 PM In reply to

    Re: Populate checkbox from Sharepoint List

    Ooooh, I wonder if it is because they can be blank? Can you bind option buttons to that field in your form?

    Hilary Stoupa

  • 09-03-2010 01:08 PM In reply to

    • Bexx27
    • Not Ranked
      Female
    • Joined on 09-03-2010
    • Posts 6

    Re: Populate checkbox from Sharepoint List

     Yeah it can be option buttons. They too do not populate either.

  • 09-03-2010 02:08 PM In reply to

    Re: Populate checkbox from Sharepoint List

    I wonder if you could add a calculated column to your list that doesn't show in the view, and is a number (like in your test) based on the value of your Yes / No column, then use that field for the checkboxes in your form?

    Or, I suppose, since this is a secondary data source and you are probably just displaying the data, maybe have expression boxes for "Yes" or "No" in your form based on the value of the field? Just some random thoughts....

    Hilary Stoupa

  • 09-03-2010 02:45 PM In reply to

    • Bexx27
    • Not Ranked
      Female
    • Joined on 09-03-2010
    • Posts 6

    Re: Populate checkbox from Sharepoint List

    Thanks for your suggestions. As I am just trying to display whether or not the features are available based on a search I have started using expression boxes to display text.. ie Internet Available. Then I set the the conditional formatting on the expression box to be visible or not based on the value of the yes/no column.

    I would like to figure out why I am not able to get the checkbox working so I will go back to that problem on Tuesday but for now I can move on and display the data in a different way. I will try using a calculated column in my sharepoint list, that may simplify things.

    Is it possible to create a field that captures the Yes/No data and stores it as a more workable value, then use that value to generate a checkbox... out of curiosity. 

    Also, is there a good site for Infopath tutorials. 

    Thanks for your help, I will touch back on Tuesday after I have played around with the checkbox problem again.

  • 11-15-2010 04:39 AM In reply to

    Re: Populate checkbox from Sharepoint List

    I had the same problem and followed your suggestion. The return value from the sharepoint list was a number 1.
    I used this formula to have a true/false value shown to the user: contains(<your_checkbox_column>, "1")

    Searched a bit and apparantly xpath can handle a little if then else. So we can set any text we want like this:
    concat(
       substring("yes", 1, number(contains(<your_checkbox_column>, "1")) * string-length("yes")),
       substring("no", 1, number(not(contains(<your_checkbox_column>, "1"))) * string-length("no"))
    )
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.