Can I integrate data from previous submissions in Notification email?

  • stan43
    Asked on November 25, 2018 at 7:43 PM

    Suppose I have a number field on my Form, e.g. "Attendees". User enters 1 through 4. Can I create a hidden field on my Form that will calculate the sum of "Attendees" in all submissions, so that I can include it in the Notification email? I know there is a Widget for counting submissions, but this is not what I want.

  • AshtonP
    Replied on November 26, 2018 at 4:44 AM

    Please note all calculations done on the forms are limited to the respective submissions hence the data cannot be populated on the subsequent submissions. 

    However, widgets like Inventory and Gift Registry may help you to keep the attendee's list calculated overall. 

    Could you please review these two widgets and let us know if that works for you?

  • stan43
    Replied on November 26, 2018 at 1:33 PM

    The Inventory  widget comes close. It looks like it creates a field somewhere that stores the running "total remaining", and that field is accessible to the (PHP?)  script that builds the form. There would also be (PHP?) code on the submission side, hopefully before the Notification email is built, that subtracts the number entered from the "total remaining". So how do I put the "total remaining" into the Notification email?

    It also seems easy to create another widget that instead of subtracting the number entered from the  "total remaining", it would add the number entered to the running "overall total".

    BTW, I know just enough about PHP to be dangerous.(smiling emoji)

  • Mike
    Replied on November 26, 2018 at 5:29 PM

    I am afraid it will not work since we do not support code injections in the form builder. Even if we use a form source code embed method, we might not be able to get the "total remaining" value, since the Inventory widget is being loaded from an Iframe, and Cross-Origin requests might be blocked.

    In theory, the next setup should work. While using the regular Number field for the "Attendees" field, get the form source code and host it on your page. You may write and add to your page a custom script that will fetch the previous submissions using the JotForm API to calculate the "total number" value and put it in a hidden form field.


  • stan43
    Replied on November 26, 2018 at 8:32 PM

     Thanks for your help, but this is getting way too complicated. I will have to find a different path to my solution. I sort of understand what you are saying, but 1) my site is a lot like JotForm - it does not support "code injection", not even into an iframe and 2) I wouldn't know how - I am not a Web coder.