Average Value Returns as Zero

I'm trying to take a few readings from an oscilloscope. I made a simple VI to test all of the parameters for the oscilloscope and make sure that everything was working before implementing the oscilloscope in a much more elaborate VI. I want to have voltage at a certain level (say, 2 V) then take a reading from the oscilloscope, add that value as a new element in an array. After doing this 100 times the VI will add the average value to a spreadsheet and then increase the voltage (to 2.05 V or something) and take 100 more measurments and average/record them. I was able to take ten sets of 100-sample averages and write them to an array (see notbroken.png) on one file, but when I try to do it in the real program (see broken.png) I check my spreadsheet and each entry is "0.000." Note that I've also created a program that controls the power supply independently and verified that I know how to control it properly; in fact, the only non-zero column is the one which reads the voltage that the program is telling the power supply to output. 
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Solved!
Go to Solution.
Attachments:
broken.png ‏53 KB
notbroken.png ‏42 KB

vweltin wrote:
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Here's an exact analysis.
Both of your programs are broken, but the one with the FOR loop iterates only 10 times, thus you get arrays with one nonzero value (the last one) when the loop terminates. (Just because the average is nonzero, does not mean it is correct!)
Your code with the while loop iterates 11 times, but your array only has 10 elements, meaning that in the last iteration you try to replace an element that does not exist and the array remains at all zeroes.
In both programs, there will never be more than one non-zero element in the array.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Return with zero value

    Dear All
    Plz see below comments of Sujay.. can any one tell me is there any other sollution for that? plz note, while i am trying to use 501 MVT with ZSPR there is no FI doccument generated but if i use ROH material, then fi doc generated with value.. why and how it is happening?
    plz advice
    Subject: Re: maintaining spares returned
    Message: As per your mentioned specification what i see is  material type ZSPR is a valuated material, so in that case if you doing reverse movement 202 wrt 201 then it should cancel the effect of 10.00 RS, which the system is doing correctly.
    Now coming to your question if you want to return the material to your respective store without any valuation, then why don't you do 501 movement.
    BR

    thanks for clarification.
    however it will not change the answer in general.
    return from user departments are usually done with 202 movement, 501 is usually used for receipts from external vendors without having a PO.
    In any case the movements will be valuated with the price in the material master, if the material type is quantity and value managed.  
    There is only one option to return at zero value: make the field fo external valuation in the movement optional, and try then to enter a zero manually while executing the movement. This will post the movement with no value and reduce the MAP of the material accordingly.
    But this is pretty dangerous as you will not really have a control about the use of this field, any user can enter any value and will effect the material prices.

  • Bytes at serial port returns allways zero value

    hello, in my code don't works Bytes At Port as I'm expexting. Program receieves data normally, but Bytes At Port return allways zero.
    2nd problem: It is possible to use VISA Read in both of parallel loops ? Purpose of my first loop is sending commads and I want to evaluate synchronous answers imediatly in this loop. Second loop receieves and evaluates asynchronous data flowing from the measurement device when measurement is acitivated.
    Thanks.

    You're sort of answering your first question with your second question. In the first loop the Bytes at Port is meaningless, unless you are intending to use it to perform a read in there. However, since you're reading in the second loop (incorrectly, by the way - more on that later), then there's nothing in the buffer, so you'll get zero.
    You can read in as many places as you want. Whether or not it makes sense to do is a different story. It depends on how the data is coming over the serial port. If the instrument you're talking to is sending data continuously, but "sneaks" in a response to a command between two messages, then you obviously don't want to be reading the response to the command in your second loop. The serial port is just one pipe. It's up to you to determine where the data belongs. Furthermore, you can't be guaranteed of getting all of the bytes at once, which means you might read, say, part of the "asynchronous" message, then get the rest in the next iteration as well as the responsed to a command you sent. As far as the Bytes At Port is concerned, it just sees a bunch of bytes. It doesn't know that, for example, the first 2 are the remainder of the asynchronous message, and the rest are the response to the command. Does the instrument not have something in the communication protocol to  allow you to distinguish?
    As promised, the way you're doing the read: You are setting up the configure VI to disable the termination character, yet you are wiring a termination character. Which is it? Do you want the read to stop at the termination character, or not? If you don't use a termination character, then you need to use Bytes At Port so you know how many bytes to read. You have that property node in the second loop, but you are not using it. Instead you are wiring a constant of 1000 to the VISA Read. This will only work if you have termination enabled. But you don't. See the problem?

  • Numbers:  Check Boxes returning 0 (zero) value

    In Numbers I would like to add a check box column next to a column of numbers.  If the box is checked I would like it to convert the specifc number in the agacent column to a value of 0 (zero).  If the box is left unchecked the value will stay as written.  Is there a function that can be written to accomodate this?

    Hi neofyte,
    Wayne's demonstration has a feature that my demonstration lacks. Wayne has correctly avoided Column A, because in some Templates Column A is a Header Column. Header Columns are best used as identifiers (for example, Name or Customer Number).
    If your Table has Column A as a Header Column (often a coloured fill), the solution would look somethig like this:
    Formula in Cell D2 is
    =IF(C,0,B2)
    Regards,
    Ian.

  • Void Methods and Value Returning Methods in Java

    Hello,
    I'm new here so please let me know if I overstep any of the rules or expectations. I merely want to learn more about Java Programming efficiently, and easily. I can ask and discuss these topics with my online prof, but she doesn't have much time.
    So right now I'm trying to solve a problem. It's a typical college level computing problem which I've already turned in. So I'm not looking for someone to do my homework for me or something. It's just that the program didn't work. Even though I probably won't get a very good grade for it, I want to
    make it work! I'm kind of slow when it comes to java so just bear with me.
    The prof wanted us to write an algorithm that reads a student's name and 6 exam scores. Then it computes the average score for each student, assigns a letter grade, using a rating scale:
    90 and above = A
    80 - 89 = B
    70 ? 79 = C
    60 - 69 = D
    Less then 60 ? F
    We had to use a void method to determine the average score for each student, a loop inside the method to read the and sum the 6 scores but without outputting the average score. The sum and average had to be returned in and output in void main.
    Then we had to use a value-returning method CalculateGrade to determine and return the grade for each student. But it can't output the grade because that must be done in void main.
    Finally the class average must be output.
    Our prof gave us a list of student names with their 6 scores.
    Ward 100 54 98 65 35 100
    Burris 89 65 87 84 15 32
    Harris 54 21 55 87 70 54
    Bettis 43 55 68 54 15 25
    Staley 87 54 98 45 54 56
    Randle 54 87 54 98 65 15
    Maddox 56 14 40 50 40 50
    Roth 30 40 54 78 24 19
    Holmes 14 87 98 34 55 57
    So all the data had to be read from a file and the results output to a file. Also we couldn't use 'global variables'. We had to use the appropriate parameters to pass values to and from methods.
    Question 1:  What does she mean by 'no global variables'? Maybe she means: don't use "*double test1, test2, test3, test4, test5*;"
    Anyway because I'm a slow learner with Java, I end up looking for sample programs that seem to do a similar job as the problem posed. So with this program I decided to adapt a program called Comparison of Class Averages.
    //Program: Comparison of Class Averages.
    import java.io.*;
    import java.util.*;
    import java.text.DecimalFormat;
    public class DataComparison
    public static void main (String[] args) throws
    FileNotFoundException, IOException
    //Step 1
    String courseId1; //course ID for group 1
    String courseId2; //course ID for group 2
    int numberOfCourses;
    DoubleClass avg1 = new DoubleClass(); //average for a course
    //in group 1
    DoubleClass avg2 = new DoubleClass(); //average for a course
    //in group 2
    double avgGroup1; //average group 1
    double avgGroup2; //average group 2
    String inputGroup1;
    String inputGroup2;
    StringTokenizer tokenizer1 = null;
    StringTokenizer tokenizer2 = null;
    //Step 2 Open input and output files
    BufferedReader group1 =
    new BufferedReader(new FileReader("a:\\group1.txt"));
    BufferedReader group2 =
    new BufferedReader(new FileReader("a:\\group2.txt"));
    PrintWriter outfile =
    new PrintWriter(new FileWriter("a:\\student.out"));
    DecimalFormat twoDecimal =
    new DecimalFormat("0.00"); //Step 3
    avgGroup1 = 0.0; //Step 4
    avgGroup2 = 0.0; //Step 5
    numberOfCourses = 0; //Step 6
    //print heading: Step 7
    outfile.println("Course No Group No Course Average");
    inputGroup1 = group1.readLine(); //Step 8
    inputGroup2 = group2.readLine(); //Step 9
    while((inputGroup1 != null) &&
    (inputGroup2 != null)) //Step 10
    tokenizer1 = new StringTokenizer(inputGroup1);
    courseId1 = tokenizer1.nextToken(); //Step 10a
    tokenizer2 = new StringTokenizer(inputGroup2);
    courseId2 = tokenizer2.nextToken(); //Step 10b
    if(!courseId1.equals(courseId2)) //Step 10c
    System.out.println("Data error: Course IDs "
    + "do not match.");
    System.out.println("Program terminates.");
    outfile.println("Data error: Course IDs "
    + "do not match.");
    outfile.println("Program terminates.");
    outfile.close();
    return;
    else //Step 10d
    calculateAverage(group1, tokenizer1, avg1); //Step 10d.i
    calculateAverage(group2, tokenizer2, avg2); //Step 10d.ii
    printResult(outfile,courseId1,1,avg1); //Step 10d.iii
    printResult(outfile,courseId2,2,avg2); //Step 10d.iv
    avgGroup1 = avgGroup1 + avg1.getNum(); //Step 10d.v
    avgGroup2 = avgGroup2 + avg2.getNum(); //Step 10d.vi
    outfile.println();
    numberOfCourses++; //Step 10d.vii
    inputGroup1 = group1.readLine(); //Step 10e
    inputGroup2 = group2.readLine(); //Step 10f
    }//end while
    if((inputGroup1 != null) && (inputGroup2 == null)) //Step 11a
    System.out.println("Ran out of data for group 2 "
    + "before group 1.");
    else //Step 11b
    if((inputGroup1 == null) && (inputGroup1 != null))
    System.out.println("Ran out of data for "
    + "group 1 before group 2.");
    else //Step 11c
    outfile.println("Avg for group 1: " +
    twoDecimal.format(avgGroup1 / numberOfCourses));
    outfile.println("Avg for group 2: " +
    twoDecimal.format(avgGroup2 / numberOfCourses));
    outfile.close(); //Step 12
    public static void calculateAverage(BufferedReader inp,
    StringTokenizer tok,
    DoubleClass courseAvg)
    throws IOException
    double totalScore = 0.0;
    int numberOfStudents = 0;
    int score = 0;
    if(!tok.hasMoreTokens())
    tok = new StringTokenizer(inp.readLine());
    score = Integer.parseInt(tok.nextToken());
    while(score != -999)
    totalScore = totalScore + score;
    numberOfStudents++;
    if(!tok.hasMoreTokens())
    tok = new StringTokenizer(inp.readLine());
    score = Integer.parseInt(tok.nextToken());
    }//end while
    courseAvg.setNum(totalScore / numberOfStudents);
    }//end calculate Average
    public static void printResult(PrintWriter outp,
    String courseId,
    int groupNo, DoubleClass avg)
    DecimalFormat twoDecimal =
    new DecimalFormat("0.00");
    if(groupNo == 1)
    outp.print(" " + courseId + " ");
    else
    outp.print(" ");
    outp.println("\t" + groupNo + "\t "
    + twoDecimal.format(avg.getNum()));
    So my adaptation turned out like this:
    //Program: Compute individual and class averages from input file.
    import java.io.*;
    import java.util.*;
    public class Exams
    public static void main (String[] args)
    throws FileNotFoundException
    //Step 1
    String nameId; //student name ID for list
    int numberOfStudents;
    DoubleClass avg = new DoubleClass(); //average for a student
    //in list
    double avgList; //average for list
    //Step 2 Open the input and output files
    Scanner group1 = new Scanner(new FileReader("c:\\list.txt"));
    PrintWriter outfile = new PrintWriter("c:\\student.out");
    avgList = 0.0; //Step 3
    numberOfStudents = 0; //Step 5
    //print heading: Step 6
    outfile.println("NameID List Student Average");
    calculateAverage(list, avg); //Step 7d.i
    printResult(outfile,nameID, avg); //Step 7d.iii
    avgList = avgList + avgList.getNum(); //Step 7d.v
    outfile.println();
    numberOfStudents++; //Step 7d.vii
    outfile.printf("Avg for List: %.2f %n",
    (avgList / numberOfStudents));
    public static void calculateAverage(Scanner inp,
    DoubleClass courseAvg)
    double totalScore = 0.0;
    int numberOfStudents = 0;
    int score = 0;
    score = inp.nextInt();
    courseAvg.setNum(totalScore / numberOfStudents);
    }//end calculate Average
    public static void printResult(PrintWriter outp,
    String nameId,
    int groupNo, DoubleClass avg)
    if (list == list)
    outp.print(" " + nameId + " ");
    else
    outp.print(" ");
    outp.printf("%9d %15.2f%n", list, avg.getNum());
    I guess I was trying to find a shortcut that ended up being a long cut. Here's the algorithm I wrote.
    Algorithm
    1.) Initialize the variables
    2.) Get the student name and his/her accompanying 6 exam scores, limiting the number of scores to 6.
    3a.) Calculate score of 6 exams for each student using void method called CalculateAverage.
    3b.) Use a loop inside the method to read and sum the six scores.
    4.) Use value-returning method CalculateGrade to determine and return each student's grade.
    5.) Output each student's grade in void main.
    6.) Calculate the average score for all students
    7.) Output entire class average
    And now I'm trying to piece together code to match each step of the algorithm starting from scratch.
    So I got the code for outputting each students grade in void:
    public static void printGrade(double testScore)
    System.out.print("Line 10: Your grade for "
    + "the course is ");
    if (testScore >= 90)
    System.out.println("A");
    else if (testScore >= 80)
    System.out.println("B");
    else if (testScore >= 70)
    System.out.println("C");
    else if (testScore >= 60)
    System.out.println("D");
    else
    System.out.println("F");
    This code can read the the file with the scores:
    Scanner inFile =
    new Scanner(new FileReader("a:\\studentlist.txt"));
    PrintWriter outFile =
    new PrintWriter("a:\\avg.out");
    courseGrade = inFile.nextDouble();
    studentName=inFile.nextChar();
    while (inFile.hasNext())
    studentName= inFile.next().charAt(0);
    courseGrade= inFile.nextDouble();
    I'm just trying to piece this thing together. Any tips would be appreciated. I will return with more pieces to the puzzle soon. As you can tell it's all kind of disorganized, and scatterbrained. Just trying to find some simplification or distillation, or recommendations.
    WR

    Hello,
    Thanks for your reply. So I take it you are more familiar with Object Oriented Programming more than Procedural Based Programming?
    Well the teacher insisted I follow the algorithm instead of trying to adapt another program to the problem. But sometimes that approach saves time I've noticed since many of the code examples we study in Java are like 'the golden oldies'.
    The student gradebook problem is repeated over and over in different forms. Maybe if I just approached the problem more linearly:
    Algorithm
    1.) Initialize the variables
    String studentId
    int numberOfStudents
    DoubleClass avg = new DoubleClass(); //average for a student
    double avgGroup: //average for all students2.) Get the student name and his/her accompanying 6 exam scores.
    Scanner group = new Scanner(new FileReader("c:\\list.txt"));
    PrintWriter outfile = new PrintWriter("c:\\student.out"));
    3a.) Calculate score of 6 exams for each student using void method called CalculateAverage using a loop to read and sum the six scores. The loop must be inside the method. It does not output the average score. The sum and average must be returned and output in void main.
    method calculateAverage
    double totalScore //to store the sum of all the scores of each student
    int numberOfExams;  //to store the number of
    int score; //to read and store a course score
    double totalScore = 0.0
    int numberOfExams = 0;
    int score = 0;3b.) Use a loop inside the method to read and sum the six scores.
    Using psuedocode (since the variables have been declared and initialized)
    i)get the next student score
    RIght here my approach of adapting another program to my new program becomes problematic
    the pseudocode here is:
    ii) while (score != -999):
    I.) update totalScore by adding course score read in step i.
    II.) increment numberOfExams by 1
    III.) Get the nex student score
    iii) studentAvg.setNum(totalScore / numberOfExams);
    *What is the purpose of the statement while (score != -999)?*
    I don't see why they picked -999?  Will this loop allow me to read an endless number of student names and theri accompanying number of exams and then find the average for each student?
    I'll go into the next algorithmic steps later.
    4.) Use value-returning method CalculateGrade to determine and return each student's grade.
    5.) Output each student's grade in void main.
    6.) Calculate the average score for all students
    7.) Output entire class average
    Thanks ahead of time for any suggestions, tips.

  • Creating function to calculate average value

    Hi,
    The below query was successfully return an average value. It returned 1 row.
    SELECT AVG(Volume)
    FROM security
    WHERE
    Type = 'Future' AND
    Rating = 'AAA' AND
    Code = 1 AND
    (Day = ''14-mar-09' OR
    Day = '16-mar-09' OR
    Day = '');
    I tried to use that function on my created function below.
    CREATE OR REPLACE FUNCTION fn_Vol_Average
    ( v_DayLast_1_Week IN DATE,
    v_DayLast_2_Week IN DATE,
    v_DayLast_3_Week IN DATE )
    RETURN NUMBER IS
    v_Vol_Average NUMBER;
    BEGIN
    SELECT AVG(Volume) INTO v_Vol_Average
    FROM security
    WHERE
    Type = 'Future' AND
    Rating = 'AAA' AND
    Code = 1 AND
    (Day = v_DayLast_1_Week OR
    Day = v_DayLast_2_Week OR
    Day = v_DayLast_3_Week);
    RETURN NVL(v_Vol_Average, NULL);
    END;
    I called that function by the following query. it was work, however it return the whole rows. It looks like the function perform the average calculation of each rows on the table.
    Can anyone help me what is going on with the logic?
    select fn_Vol_average('14-mar-09','16-mar-09','')
    from security
    --

    But since your function calculates the average over the whole security table, you wouldn't call this from a select statement which also reads the security table.
    You just want to execute it once.
    declare
       l_vol_average number;
    begin
       l_vol_average := fn_Vol_average('14-mar-09','16-mar-09','');
       dbms_output.put_line(l_vol_average);
    end;By the way, be careful with your date parameters. You should use TO_DATE with a proper format mask to prevent conversion errors.

  • When Requested for a Grand Total the column values changes to zeroes

    Hi,
    I have a report with 2 dimensions and 4 facts. The report is showing the correct data when compared with EBS, but when we are applying grand total in Table View then for fact values are displaying zeroes. However the grand total is correct but for some dimensions the measures are displaying zeroes.
    At this point i have modified the Aggregation rule of 1 measure from Default to SUM and when i clicked results Wonder, i can see grand total and the zeroes were replaced with actual values. When i have compared logical queries before applying the aggregation and after, the measure is surrounded with function REPORT_AGGREGATE and REPORT_SUM respectively.
    Can anyone explain me why is this behavior occurred, i got the solution but i am not in stage to explain to client why it happened.
    Kindly help and i will make sure it is definitely marked.

    Re:  Bottom Line Grand Total
    Use the Subtotal function instead of the Sum function for all totals.
    The Subtotal function ignores other Subtotal functions in the column you are summing.
    Your three "Sum" functions would look something like...
    =SUBTOTAL(9,J3:J7)    '300
    =SUBTOTAL(9,J8:J14)  '900
    =SUBTOTAL(9,J3:J14)  '1200
    '--- Info
    1    AVERAGE
    2    COUNT
    3    COUNTA
    4    MAX
    5    MIN
    6    PRODUCT
    7    STDEV
    8    STDEVP
    9    SUM
    10    VAR
    11    VARP
    Jim Cone
    Portland, Oregon USA
    free and commercial excel programs at...
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • (audio) maxBlip returned as zero!!!!!

    Hi,
    I'm using the Exporter Sample and in the audio code SDKFile.cpp "prMALError RenderAndWriteAllAudio(exDoExportRec *exportInfoP) " there is a line that gets maxBlip.
    It's coming back as ZERO when I feed AME with an avi file with 5.1 AC3. Ahhhhh.... why?
    // The lesser of the value returned from GetMaxBlip and number of samples remaining
    lRec->sequenceAudioSuite->GetMaxBlip (audioRenderID, lRec->frameRateTicks, &maxBlip);
    if (maxBlip == 0)      <<<<<<<<<<<<<<< I added this check{                           <<<<<<<<<<<<<<< I added this check   
    // Serious Problem.<<<<<<<<<<<<<<< I added this check
    return malUnknownError; <<<<<<<<<<<<<<< I added this check
    } <<<<<<<<<<<<<<< I added this check
    if (maxBlip < samplesRemaining)
    else
    samplesRequestedL = maxBlip;
    samplesRequestedL = (csSDK_int32) samplesRemaining;

    Ah. I think I found it…AME has a decode problem.
    The source file is AC3 5.1 and plays just fine in Windows Media Player.
    Here is AME’s (CS5.5) source data-mining and the “Stereo” mistake…
    I guess I need to find another 5.1 test file to do my testing.
    Zac, etc I can email you the 2.2Mb file if you want.

  • Need Help ::  Current row attribute value returning null

      Hi Frds,
    I am facing the problem that
    Current row attribute value returning null............ even though value is there..... plz.. he
    This is the code in PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
        String  pPersonId = pageContext.getParameter("ctrlPersonId");
         String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
         OptionsVORowImpl curRow = (     OptionsVORowImpl) am.findRowByRef(rowReference);
        String dtlsItem =  (String)curRow.getFlexValue();   /*  this is returning null value */
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks & Regards,
    jaya
    Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810

    Hi Jaya,
    You want to catch Flexfield values?
    Try below code for catch value.
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
    OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
    OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
    OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
    String dtlsItem  = (String)Stylebean.getText(pageContext);
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks,
    Dilip

  • How to get the values returned by a function in a drop down?

    Hi All,
    Can anyone please help in getting the values returned by a function into a drop down? I have a java class file where in i have written a function called getWeeks() which give all the week dates and i want to display these week dates in a drop down box in a JSP page.
    Please help me in this regard.
    Thanks in Advance!!
    Lakshman.

    Hi Lakshman,
    the following code can help you do what you want :
    <hbj:dropdownListBox id="calendar" tooltip="Calendar" selection="<%= selected %>">
    <%
    String[] weeks = myObjectBean.getWeeks();
    for (int i = 0; i < weeks.length; i++) {
    %>
         <hbj:listBoxItem key="<%= i %>" value="<%= weeks<i> %>"/>
    <%
    %>
    </hbj: dropdownListBox>
    The <%= selected %> snippet allows you to pre-select one of the options (provided that the variable 'selected' is equal to one of the listBoxItem keys).
    You can also add onSelect to the tag (e.g. = "setSelectedItem"). It corresponds to a method in the corresponding JSPDynPage class. This means that when you select another item in the dropdown list, the method in your Java class is performed (allowing you to save the selected value and performing actions with it)
    I hope this helped you enough,
    kind regards,
    Frederic
    Edited seven times by: Frederic Taes on Nov 5, 2008 11:24 AM -> the onSelect element was in the hbj tag and in the text with "='setSelectedItem'" next to it and when I tried to post my message, I got a 501 error all the time ! Seems like a SDN bug to me ...

  • Null values returned when using request.getParameters(

    I have a html form which allows the user to choose options and select a file to upload. When I use method=Post I get null values returned. When I use method=Get I get my parameter values fine.. but I get an error.
    "Posted content type isn't multipart/form-data"
    I would like to know why I am getting null values returned when using Post. I am using the following to get the values from the name=value passed to the servlet.
    String strIndustry = request.getParameter("frmIndustry");
              String strCompany = request.getParameter("frmCompany");
              String strCollabType = request.getParameter("frmCollaboration");
    I have another form where the user can search information in a database that works just fine w/ either Get or Post
    Or perhaps I am using oreilly MultipartRequest incorrectly??? but I copied it directly from another discussion.. ???
    any thoughts
    Thanks

    taybon:
    you could do it like this. in this case, you submit your form with the parameters (industry, company, collaboration), and upload your file at the same time. and in the target servlet, you can build your MultipartRequest object like this:
    MultipartRequest multi = new MultipartRequest(request, temp_location, 50 * 1024);where variable temp_location stands for a temporatory diretory for file uploading.
    and then you get your parameters, so you can build the directory with them. and after that, you can move your file to that directory using File.renameTo();
    but as i've suggested in my previous posting, i just recommend you upload your file in a separate form. and then you can perform an oridianry doPost form submit with those parameters. or you may have problems with the file uploading. (this is just my personal experiences with Multipart).
    there is one other thing i'd like to mention, file.renameTo() won't work if you need to move files to a network drive in windows. it won't work if you move files across file systems in unix.
    Song xiaofei
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD

    Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD
    I configured the user profile service application and run Sync and user profiles and its properties returned from Active directory but when I want to read it pragmatically it returns null values.
    this is my code...
       void runQueryButton_Click(object sender, EventArgs e)
               // Get the My Sites site collection, ensuring proper disposal
                using (SPSite mySitesCollection = new SPSite("http://sp/my"))
                    //Get the user profile manager
                    SPServiceContext context = SPServiceContext.GetContext(mySitesCollection);
                    UserProfileManager profileManager = new UserProfileManager(context);
                    UserProfile profile = profileManager.GetUserProfile("Contoso\\user");
                    foreach (Property prop in profileManager.Properties)
                       // if (prop.Name == "Department")
                        resultsLabel.Text += prop.DisplayName + ":" + profile[prop.Name].Value + "<br />"; ;

     Hi,
    Please try with the following code
          PrincipalContext principalContext = new PrincipalContext(ContextType.Domain);
                                SPServiceContext context = SPServiceContext.GetContext(site);
                                UserProfileManager profileManager = new UserProfileManager(context);                        
      foreach (Property prop in profileManager.Properties)
                       // if (prop.Name == "Department")
                        resultsLabel.Text += prop.DisplayName
    + ":" + profile[prop.Name].Value + "<br />"; ;
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • How do I print out the value returned by a method in main??

    I'm a total newbie at java, I want to know how I can print out the value returned by this function in the "Main" part of my class:
    public int getTotalPrice(int price)
    int totalprice=price+(price*0.08);
    return totalprice;
    I just want to know how to print out the value for total price under "public static void main(String[] args)". thanks in advance,
    Brad

    Few ways you could do it, one way would be to create an instance of the class and call the method:
    public class Test
        public double getTotalPrice(int price)
            double totalprice = price + (price * 0.08);
            return totalprice;
        public static void main(String[] args)
            Test t = new Test();
            System.out.println(t.getTotalPrice(52));
    }Or another would be to make getTotalPrice() static and you could call it directly from main.

  • To display average value in a graph

    Hi There,
    In one graph I need to display the duration for each week as per the week range selected and a separate average duration value of the weeks selected.
    Is it possible to develop a query for above average value and use this query in WAD?
    Can anybody help in providing a solution
    Thank you
    Anima

    BI Query data can be fed directly to WAD Charts.
    See below.
    http://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/content.htm

  • Assigning value returned from RFC call to a global variable

    If I have an RFC call to SAP how can I assign the value returned to a global variable on my data services job?

    Hi,
    For now, it seems u haven't specified the destination properly. the call function statement must be suffixed with the 'destination' addition to make sure that the function call is an RFC and the particular function be executed at the desired destination.

Maybe you are looking for