Answered by:
Yes/No columns for sharepoint lists

Question
-
Hey all, I've created a Yes/No custom column for a SharePoint 2010 list. Here is the code snippet.
I've tried the below way and without the brackets around the "no" and it is still defaulting to yes. How do I get a Yes/No column to default to no? Thanks in advance, Shaun.
<Field ID="{B3D2529B-CBAC-43A0-BDCE-0CAA03BF43A8}" Name="CMFolderCreated" DisplayName="Folder Created" Type="Boolean" Description="Yes/No if folder was created" Group="CM List Columns" > <Default>[No]</Default> </Field>
Wednesday, March 21, 2012 2:51 PM
Answers
-
According to MSDN, the value of a Boolean is stored as either 0 or 1:
Boolean Used to store a TRUE/FALSE value (stored in the database as 0 or 1). This field is sortable and groupable. Corresponds to the bit SQL data type and represented by theSPFieldBoolean class.
Can you try to specify a default value of "0" (or "1")
<Default>0</Default>
- Edited by Alain de Klerk Wednesday, March 21, 2012 3:11 PM
- Proposed as answer by HeToC Wednesday, March 21, 2012 5:15 PM
- Marked as answer by Shimin Huang Friday, March 23, 2012 2:40 AM
Wednesday, March 21, 2012 3:10 PM -
as Alain suggest try with <Default>0</Default>.
event while retrive also you have to pass 0 or 1 to filter Yes/No column.
http://crodrigues.com/tip-sharepoint-caml-query-filtering-boolean-fields/
MCTS,MCPD Sharepoint 2010. My Blog- http://sharepoint-journey.com
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful- Marked as answer by Shimin Huang Friday, March 23, 2012 2:40 AM
- Edited by Devendra VelegandlaMVP Wednesday, February 6, 2013 8:23 AM
Wednesday, March 21, 2012 4:01 PM
All replies
-
According to MSDN, the value of a Boolean is stored as either 0 or 1:
Boolean Used to store a TRUE/FALSE value (stored in the database as 0 or 1). This field is sortable and groupable. Corresponds to the bit SQL data type and represented by theSPFieldBoolean class.
Can you try to specify a default value of "0" (or "1")
<Default>0</Default>
- Edited by Alain de Klerk Wednesday, March 21, 2012 3:11 PM
- Proposed as answer by HeToC Wednesday, March 21, 2012 5:15 PM
- Marked as answer by Shimin Huang Friday, March 23, 2012 2:40 AM
Wednesday, March 21, 2012 3:10 PM -
as Alain suggest try with <Default>0</Default>.
event while retrive also you have to pass 0 or 1 to filter Yes/No column.
http://crodrigues.com/tip-sharepoint-caml-query-filtering-boolean-fields/
MCTS,MCPD Sharepoint 2010. My Blog- http://sharepoint-journey.com
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful- Marked as answer by Shimin Huang Friday, March 23, 2012 2:40 AM
- Edited by Devendra VelegandlaMVP Wednesday, February 6, 2013 8:23 AM
Wednesday, March 21, 2012 4:01 PM -
That worked perfectly, thank you Alain.Wednesday, March 21, 2012 5:11 PM
-
Thanks for the tip, it worked out for me. Thanks Devendra.sv!Wednesday, March 21, 2012 5:12 PM