Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Calculated field

  Asked By: Sansuma    Date: Jan 02    Category: Sharepoint    Views: 1925

I have a problem with a form I am submitting from InfoPath to a SP doc library.
The form has yes-no-n/a answers, and I gave yes a value of 1, no as 0, and n/a a
1 as well. The thought process was that n/a answers should not count against the
responder, and I am adding the number of positive responses and dividing by the
number of questions to get a percentage. But the n/a answers inflate the
percentage. Is there a way to check the value of the field, then exclude it from
the calculation? I would also need to decrement the number I am dividing by as
well. This form will have 26 questions, and this is the shortest form I have to
work with. Or is there a better way to do this?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Rafael Willis     Answered On: Jan 02

I haven't looked at the functions available, but I'm assuming standard math
functions are available. So here's what I've done in the past in other
systems. Make N/a a value of -1. Then when you want to use it in
calculations you can use the absolute value, which would be 1, but you can
still test the value to tell the difference between yes, no, and N/A.

Another approach would be to make yes (1), No (-1), and N/A (0). Then
simply add the 26 responses. If you get a positive result there were more
yes than no, a negative result more no than yes and the higher the positive
result the more yes answers  versus no or n/a.

 
Answer #2    Answered By: Richard Davis     Answered On: Jan 02

Yes, but I also need to figure out how many yes answers  there are. Maybe I need
to put this calculation  in the InfoPath form  code.

 
Answer #3    Answered By: Mason Davis     Answered On: Jan 02

Ok, I have looked up how to get to form  fields and reference in the code
accessed with the "Edit Form Code" button in InfoPath design view. I am checking
the fields, and depending on the value I am calculating a counter variable and a
score variable. The problem  is I am getting an error with MainDataSource. The
error is listed below.

 
Answer #4    Answered By: Savannah Pena     Answered On: Jan 02

Ok, I figured out the problem  with the MainDataSource error. One of the language
settings for IP was "C# (InfoPath 2003 Compatible)." So I copied the code to a
text file, removed the code from the form, then changed the setting to C#. Then
I code back in the form. Basically I was trying to refer to something that
IP2003 doesn't know about. And now I get this error.

The name 'NameSpaceManager' does not exist in the current context

Am I again referring to something that IP2007 can't reference?

 
Didn't find what you were looking for? Find more on Calculated field Or get search suggestion and latest updates.




Tagged: