Triple Posted February 4, 2011 Posted February 4, 2011 Hey guys, I have several fields that I am trying to combine into one field that would provide multiple answers based on the choices of the other fields. For example say I have 3 fields with radio buttons. First field is "How many times have you voted" choices are "None, 1, 2, 3 or more". Second field "What party do you affiliate yourself with?" choices are "Republican or Democrat" Third field "Have you ever worked for the government" choices are "yes or no" Now I have a calculation field that I want to return one answer for all of these questions.. (i.e. if "1, Republican and no" were chosen then it would show "Voted once, as republican, never worked for government" or if "none" was selected then it would return "never voted" etc...) This is what I have so far but I am getting a "0" as the return: If ( HowManyTimesVoted = "None"; "Never voted"; " ") or if (HowManyTimesVoted = "1" & PolicticalParty ="Republican" & WorkedForGovt = "No";"Voted once, as republican, never worked for government"; " ") Please help. Thanks
Russell Barlow Posted February 4, 2011 Posted February 4, 2011 Hey guys, I have several fields that I am trying to combine into one field that would provide multiple answers based on the choices of the other fields. For example say I have 3 fields with radio buttons. First field is "How many times have you voted" choices are "None, 1, 2, 3 or more". Second field "What party do you affiliate yourself with?" choices are "Republican or Democrat" Third field "Have you ever worked for the government" choices are "yes or no" Now I have a calculation field that I want to return one answer for all of these questions.. (i.e. if "1, Republican and no" were chosen then it would show "Voted once, as republican, never worked for government" or if "none" was selected then it would return "never voted" etc...) This is what I have so far but I am getting a "0" as the return: If ( HowManyTimesVoted = "None"; "Never voted"; " ") or if (HowManyTimesVoted = "1" & PolicticalParty ="Republican" & WorkedForGovt = "No";"Voted once, as republican, never worked for government"; " ") Please help. Thanks Make sure your calculation is set to return text and not number.
comment Posted February 4, 2011 Posted February 4, 2011 I suggest you use the Case() function for this. Also, you need to use the logical operator and instead of the text concatenation operator &.
Vaughan Posted February 5, 2011 Posted February 5, 2011 This could be simplified if you don't require the response to be completely prosaic and grammatically perfect. Case ( HowManyTimesVoted = "None"; "Never voted" ; "Voted " & HowManyTimesVoted & " times, as " & PolicticalParty & ", " & Case ( WorkedForGovt = "No" ; "never worked for government" ; "worked for government" ) ) You can make the function return fancier (more prosaic) results but you'll get to the stage where you'll be special-casing practically every permutation of answers. You are better off forming the question and answer in a way that it makes sense when summarised in a simple calculation. Quite aside, as an Australian the concept of people not voting is strange because voting here is compulsory. (Technically people don't have to vote but they do have to attend a polling booth: they can choose to lodge an "informal" vote if they wish which does not count.) The compulsory vote places responsibility on both the voter and the Government itself: it is required by law to get the vote from every single Australian citizen including those overseas, in remote locations (and down here we have some seriously remote locations) and those in prison serving a sentence of 3 years or less. This prevents the government from disenfranchising groups of people from their democratic rights. ;)
Triple Posted February 7, 2011 Author Posted February 7, 2011 This worked perfectly, thank you. This could be simplified if you don't require the response to be completely prosaic and grammatically perfect. Case ( HowManyTimesVoted = "None"; "Never voted" ; "Voted " & HowManyTimesVoted & " times, as " & PolicticalParty & ", " & Case ( WorkedForGovt = "No" ; "never worked for government" ; "worked for government" ) ) You can make the function return fancier (more prosaic) results but you'll get to the stage where you'll be special-casing practically every permutation of answers. You are better off forming the question and answer in a way that it makes sense when summarised in a simple calculation. Quite aside, as an Australian the concept of people not voting is strange because voting here is compulsory. (Technically people don't have to vote but they do have to attend a polling booth: they can choose to lodge an "informal" vote if they wish which does not count.) The compulsory vote places responsibility on both the voter and the Government itself: it is required by law to get the vote from every single Australian citizen including those overseas, in remote locations (and down here we have some seriously remote locations) and those in prison serving a sentence of 3 years or less. This prevents the government from disenfranchising groups of people from their democratic rights.
Recommended Posts
This topic is 5096 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now