Calculating fields after filled by a data query in Infopath - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Calculating fields after filled by a data query in Infopath

Last post 05-29-2018 10:02 AM by Hilary Stoupa. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-24-2018 11:15 AM

    Calculating fields after filled by a data query in Infopath

    I'm currently working on a form for a department supervisor. Product is inspected and submitted to a sharepoint library via a different form, and this current form will pull the data between two specified dates and show the supervisor monthly totals such as how many pieces inspected, how many rejected, % rejected, etc. I currently have a functioning search form using a data connection and a repeating table that I dragged from the data connection on the sidebar. However, I am unable to get the form to calculate sums/count total number of lines, etc. How can I calculate the values in a repeating table that has been filled by a data query within Infopath? Not sure if this is the right place for this question.
  • 05-24-2018 11:41 AM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    Just following up, screenshot of the inspected cell. The actual value here should be 117. In the field's default value I have "sum(inspected)", where inspected is the field's name under datafields in the Secondary Data Connection fields.
  • 05-24-2018 11:55 AM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    So - can you attach a copy of your form under the Options tab? I can take a look.
    Hilary Stoupa

  • 05-24-2018 11:58 AM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    The search form may not pull data properly for external users, but here is the file.
  • 05-24-2018 12:48 PM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    Looks like you aren't filtering the data in your sum function. You are hiding rows on the form, but the data is still present in the secondary data connection. The sum function needs to have the field filtered in the same way as you are filtering your repeating table. You may want to change that total_inspected field to a decimal, so you aren't getting a validation error on sum (you can use the formatting for the control to not display decimal points), and try this formula for the default (just open the formula editor for the default and paste this in place of your current formula): sum(xdXDocument:GetDOM("526 Data")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Pieces_x0020_Inspected[../d:Tempfinal != "TEMP" and msxsl:string-compare(../d:Date, xdXDocument:get-DOM()/my:myFields/my:end_date) = 0])
    Hilary Stoupa

  • 05-25-2018 02:02 PM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    Thank you for taking the time to look at my form. I understand now what went into the expression, it is filtering all files tagged "TEMP" and using the string to compare what I believe are the dates of the files. I am not getting a validation error anymore after inputting your formula. However, the new calculated value shows "0" each time it is calculated. Nonetheless, we are still making progress here, it is better than the huge number I was getting earlier. Could you teach me how you got the "msxsl:string-compare" expression and what went into it? If I can figure out how to set this up I will be able to implement this for the rest of the calculated fields.
  • 05-27-2018 06:07 AM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    I figured it out. The expression was the filter for the dates, I set it up as I did in the attached file and it can calculate values properly.
  • 05-29-2018 10:02 AM In reply to

    Re: Calculating fields after filled by a data query in Infopath

    Wonderful! Glad you have it working. :-)
    Hilary Stoupa

Page 1 of 1 (8 items)
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.