What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Problems importing contacts using JotForm C# API

    Asked by MARIA  on December 15, 2016 at 08:41 AM

    I cannot import all the jotForm contatc with my c# program.

     

    I get submissions and then all the answer


    var answer = from sub in allsubmissions  from ans in sub["answers"] where sub.Value<string>("id") == su.Value<string>("id") select ans;

     

    if I cicle the answer I do not get all the contact that I have in the Excel exstract from JotForm

     

    foreach (var items in answer)

    {

    if (items.First.Value<string>("type") == "control_email")

    email = items.First.Value<string>("answer");

    }

     

    THANKS

    Maria

  • Profile Image
    JotForm Support

    Answered by Kiran on December 15, 2016 at 09:02 AM

    Unfortunately, I am not having C# knowledge. Do you mean to read the submissions of a form using API? Did you take a look at our API documentation that is provided with Sample data and it might help in writing the code as per your requirement.

    http://api.jotform.com/docs/

    Meanwhile, I'll check with my team members if we have anyone with C# knowledge who can help you with the issue. Please provide us with more information of the issue that you are experiencing that can help us in providing you with necessary assistance.

    Thank you! 

  • Profile Image

    Answered by Maria  on December 15, 2016 at 09:16 AM

    With c# jot form API I can get all the submission and the answers

    I did a program that get all the informations I need

    but when I cicle the submissions and then when I cicle the answers of all the submissions I get Just some contact but not all of them

     

    If I extract the Excel of a specific submission from Jotform I get some contact more

    Thanks

  • Profile Image
    JotForm Support

    Answered by Kiran on December 15, 2016 at 09:32 AM

    I understand that you are getting the form submissions using API and you are looping the submissions. Do you mean to say that the looping of the submissions is not working? 

    Could you provide us with the complete code that you are using to loop the submissions to take a look?

  • Profile Image

    Answered by maria  on December 15, 2016 at 09:43 AM

     

     

     var client = new JotForm.APIClient(Properties.Settings.Default.JotFormApiClient);

     

    var user = client.getUser();

     

     

     

     

     

     

    var forms = client.getForms()["content"];

     

     

     

     

     

     

    var idTitles = from form in forms

     

    select form.Value<string>("id");

     

     

     

     

     

     

     

     

               

     

     

     

     

     

     

    foreach (var item in idTitles)

     

     

     

    {

     

     

                  

     

     

     

     

     

     

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item))["content"];

     

     

    var submissions = from sub in allsubmissions

     

    where sub.Value<DateTime>("created_at") >= Convert.ToDateTime(Properties.Settings.Default.data)

     

    select sub;

     

     

     

     

     

     

     

     

     

     

    foreach (var su in submissions)

     

     

     

    {

     

     

                       

     

    string email = "";

     

     

     

     

     

     

                       

     

     

     

    var answer = from sub in allsubmissions

     

    from ans in sub["answers"]

     

    where sub.Value<string>("id") == su.Value<string>("id")

     

    select ans;

     

     

     

     

     

     

    foreach (var items in answer)

     

     

     

    {

     

     

    Console.Out.WriteLine(items);

     

     

     

     

     

     

     

     

     

    if (items.First.Value<string>("type") == "control_email")

     

    email = items.First.Value<string>("answer");

     

     

    }

    }

     

     

    thanks

     

     

     

     

     

     

     

     

          

     

     

     

     

     

     

     

               

     

               

     

     

     

     

     

     

     

     

                       

     

     

     

     

     

     

     

     

  • Profile Image

    Answered by KadeJM on December 15, 2016 at 10:51 AM

    Thank you for providing us with your current c# script.

    Please allow us some time to look this over and we will get back to you about it as soon as possible.

  • Profile Image

    Answered by Ylenia89 on December 15, 2016 at 11:03 AM

    Yes thanks

     

    the only filter I put is

    var submissions = from sub in allsubmissions

     

     where sub.Value<DateTime>("created_at") >= Convert.ToDateTime(Properties.Settings.Default.data)

     

     select sub;

     

    the form I was working with is

    id 60704494096359

    title 01immagini

     

    if you need I can give you a contact I cannot find

     

     

    thanks

    Maria

     

  • Profile Image

    Answered by Ylenia89 on December 16, 2016 at 05:08 AM

    Hi

    I CHECKED IF THE PROBLEM WAS IN THE DATE BUT I DO NOT FIND ANY DIFFERENCE BETWEEN THE CONTACT EXTRACTED AND THE CONTACT I DO NOT FIND

     

     

    IF YOU NEED I CAN GIVE YOU SONE EXAMPLES

     

    THANKS

     

    MARIA

  • Profile Image
    JotForm Support

    Answered by Boris on December 16, 2016 at 05:55 AM

    Thank you for providing your script and the form in question (60704494096359).

    Can you please provide an example contact that you cannot find, as well as an example contact that you are able to find? This is so that we can compare the recorded data whether there may be differences in this data within your submissions, and check for possible causes of the issue you are experiencing.

    Looking forward to your response. Thank you!

  • Profile Image

    Answered by Santoshk on December 16, 2016 at 06:24 AM

    Problem still exists. Sharing the latest submission after updating the url shared by you.

     

    There was Employee Name as Santosh Kumar and Employee Code/AD ID as 900980. But when i used the prepopulate link. Both these fields are not reflected

    Below is the screen shot as the same is not pre populated.

    Link received in auto response is below

    https://www.jotform.com/63363449763465?reason1=&reason2=Testing%20Reason2&whyHas=Testing%20Supervisor%20Comments&location=Hyderabad&currentSupervECode=&rhrName=Santosh&rhrComments=Comments%20Testing&whatMeasures=Testing%20Supervisor%20retaining%20measures&employeeCodead=&designation110=Asst%20Manager&rhrEmail111=santoshk@tminetwork.com&dateOf112=12-05-2016&lastWorking=12-14-2016&1My114=Yes&2I=No&3I=Yes&4I=No&5My=Yes&6I=No&7I=Yes&8The=Yes&9I=No&10I=Yes&11I=No&12I=Yes&voluntary=Personal%20reason-%20Medical&involuntary=&employeeName=&supervisorName=BSLI%20MIS&supervisorEmail=bslimis@tminetwork.com&locationCode=987&currentSuperviname=&question1134=&question2135=&question3=&question4=&question5=&question6=&question7=&question8=&question9=&question10=&question11=&question12=&howMany153=324

     

    I have hilighted both the cases as the same was blank in the link received.

  • Profile Image
    JotForm Support

    Answered by Boris on December 16, 2016 at 06:32 AM

    @Santoshk, you have replied on another person's support thread regarding a totally different topic. For this reason, and so we can assist you with your own issue as well, your post has been moved to a support thread of your own:

    https://www.jotform.com/answers/1013283

    You will be assisted there, shortly. Thank you.

  • Profile Image

    Answered by Maria  on December 16, 2016 at 06:34 AM

    lino.b69@libero.it I can find this contact

     

    g.daddino@virgilio.it I can't find this one

     

    I haven' understood the problem

     

    Is it possible to get those contact?

    thanks

     

     

     

     

  • Profile Image
    JotForm Support

    Answered by ashwin_d on December 16, 2016 at 07:43 AM

    Hello Maria,

    Though I do not have much exposure on C# but I did check the code you have shared and it seems the issue is related to the filter date you have in your code:

    var submissions = from sub in allsubmissions

    where sub.Value<DateTime>("created_at") >= Convert.ToDateTime(Properties.Settings.Default.data)

    select sub;

    You seems to be trying to filter submission where the submission date time is greater or equal to current system date/time.

    g.daddino@virgilio.it has submission date/time as 2016-12-14 11:02:59

    lino.b69@libero.it has submission date/time as 2016-12-15 16:08:36

     

    I have a question: Why do you want to add sate filter anyway? Even if you want to add filter, it should be something as below:

    var submissions = from sub in allsubmissions

    where sub.Value<DateTime>("created_at") <= Convert.ToDateTime(Properties.Settings.Default.data)

    select sub;

    Do try it out and get back to us if you have any trouble.

    Thank you!

  • Profile Image

    Answered by maria  on December 16, 2016 at 07:57 AM

    thank you for the help but

     

    my data in the settings Properties.Settings.Default.data is 10/10/2016

     

    I also tried to change the data in 10/10/2015 but it was the same

     

    I need to get all the submissions created after 10/10/2016

    so with this code I should get both of those contact

     

     

  • Profile Image

    Answered by maria  on December 16, 2016 at 08:20 AM

    I get the client with my api key

    var client = new JotForm.APIClient(Properties.Settings.Default.JotFormApiClient);

     

    then I get the form

    var forms = client.getForms()["content"];

     

    then I get the Id of the form

    var idTitles = from form in forms select form.Value<string>("id");

     

     

    for each form i get the submission whose creation date should be greter than 10/10/2016

    foreach (var item in idTitles)

    {

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item))["content"];

    var submissions = from sub in allsubmissions

     

    where sub.Value<DateTime>("created_at") >= Convert.ToDateTime(Properties.Settings.Default.data) select sub;

     

     

     

     

     

     

     

     

     

     

     

     

  • Profile Image
    JotForm Support

    Answered by Boris on December 16, 2016 at 08:40 AM

    Thank you for the added clarifications, Maria. As explained in our API documentation, by default the lookup of submissions on a form will return only 100 submissions:

    https://api.jotform.com/docs/#form-id-submissions

    limit (Number)
    Number of results in each result set for form list. Default is 100. Maximum is 1000.
    Example: 30

    I see that submissions from lino.b69@libero.it are 96 and 97 of your last received submissions, while submission from g.daddino@virgilio.it is 286. If you are calling for submissions through API without specifying the limit parameter on your call, it will only return up to 100 submissions.

    Please make sure you adjust your call and increase the "limit" parameter in your API call.

    Similarly, and described in the same section of our documentation, you can perform your desired filtering by date directly on the API call:

    Please try making these adjustments, and let us know how it goes. Thank you!

     

  • Profile Image

    Answered by maria  on December 16, 2016 at 08:58 AM

    Thanks

     

    could you please tell me how can I change this value?

     

    thank you

  • Profile Image

    Answered by pagine on December 16, 2016 at 09:46 AM

    I changed the limit in all the form i put 1000

    but I still cannot find the contact g.daddino@virgilio.it and others

    regarding the filter it has to be a variable form me

     

    thank you

  • Profile Image

    Answered by pagine on December 16, 2016 at 09:55 AM

    I did it but I still can't find my submission

     

    thank you

  • Profile Image
    JotForm Support

    Answered by Kiran on December 16, 2016 at 10:15 AM

    Please allow us some time to check on this issue and get back to you with relevant information.

    Thank you for your patience. 

  • Profile Image

    Answered by pagine on December 16, 2016 at 10:39 AM

    to change the limit I went in all the form then preference

     

    state

    disabled on submission limit

     

    value 1000

     

    but all the form were not working anymore and I had to change all of them

    Could you please explain me what can I do

     

    thanks

     

    Maria

  • Profile Image
    JotForm Support

    Answered by Boris on December 16, 2016 at 12:05 PM

    You are referring to a different feature! You seem to be talking about form submission limits, which are not related to what you are trying to do with our API.

    The following guide describes how to set up form submission limits, and we are not suggesting that you set up form submission limits in any relation to what you are trying to achieve with our API:

    https://www.jotform.com/help/137-How-to-limit-submissions-in-a-form

    Our API is a separate thing. When you use our API, you use queries such as this to fetch your data:

    https://api.jotform.com/form/{your-form-ID}/submissions?apikey={your-API-key}&limit={number-of-submissions-you-are-looking-for}&orderby=id

    If you do not specify any specific value in the &limit part of your API call, when your app is making an API call to our system, you will receive data from only up to 100 submissions.

    If you are using our c# library to make these API calls for you, then you must adjust your calls within your app. Essentially, when you use getFormSubmissons in this line:

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item))["content"];

    You are not specifying how many items it should return. It will return the default, which is 100. Please try using the following line to increase it up to 1000:

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item), 0, 1000)["content"];

    Here is the relevant documentation about how getFormSubmissons works:

    getFormSubmissons(long formID, int offset = 0, int limit = 0, Dictionary<String, String> filter = null, String orderBy = null)
    { }

    /// <param name="formID">Form ID is the numbers you see on a form URL. You can get form IDs when you call /user/forms.</param>
    /// <param name="offset">Start of each result set for form list. (optional)</param>
    /// <param name="limit">Number of results in each result set for form list. (optional)</param>
    /// <param name="filter">Filters the query results to fetch a specific form range.(optional)</param>
    /// <param name="orderBy">Order results by a form field name. (optional)</param>
    /// <returns>Submissions of a specific form</returns>

    You can also see it in the source code of our c# library:

    https://github.com/jotform/jotform-api-csharp/blob/master/JotForm/APIClient.cs#L375

    Please let us know if this resolves the issues you were having.

  • Profile Image

    Answered by pagine on December 19, 2016 at 05:47 AM

    thank you for the help

     

    as I have more than 1000 submission can you help me by add a filter for creationdate here?

     

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item), 0, 1000)["content"];

     

    something like

    var allsubmissions = client.getFormSubmissons(Convert

     

    .ToInt64(item), 0, 1000, ("created_at") >= myDataStart &&  ("created_at") <= myDataEnd )[

    "content"];

     

     

     

     

  • Profile Image
    JotForm Support

    Answered by emily on December 19, 2016 at 06:11 AM

    Hi,

    Unfortunately I do not have enough knowledge about this issue. However I am informing my colleagues, who answered you before, about your problem.

    They will get back to you with the relevant information. 

    Thank you for your understanding.

  • Profile Image
    JotForm Support

    Answered by Boris on December 19, 2016 at 09:00 AM

    I'm afraid I do not have any experience with c# coding, but you should be able to use a line such as this:

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item), 0, 1000, "created_at:gt":"2016-10-10 00:00:00")["content"];

    The filter "created_at:gt":"2016-10-10 00:00:00" will get all submissions made since  2016-10-10 00:00:00, which is what I believe you were after originally.

    Please first try out the above mentioned call with a hard-coded filter in a string, and if it works correctly based on your needs, then you can proceed on modifying your script further to use your date variables inside the filter instead of the hard-coded string.

    In any case, customization of your own code is unfortunately outside of the scope of our technical assistance, so I would recommend going through our API documentation if you need further understanding of how to use the API. Additionally, for specific questions about anything that might look vague in our API documentation, you may want to reach out to our dedicated API team:

    api@jotform.com

    They will be happy to provide clarifications if any is needed about some part of the API, but same as our technical support in the forum, please do not expect for the API team to assist with actual script building. We only provide the API so you can use your own programs to access the data programmatically.

    Thank you.

  • Profile Image

    Answered by pagine on December 19, 2016 at 09:33 AM

    there should be something wrong in the sintax because visual studio doesn't accept this string

     

    var allsubmissions = client.getFormSubmissons(Convert.ToInt64(item), 0, 1000, "created_at:gt":"2016-10-10 00:00:00")["content"];

     

     

    the 4th parameter should be a system.collection.generic.dictionary

  • Profile Image

    Answered by KadeJM on December 19, 2016 at 10:18 AM

    We do apologize for the provided custom coding giving you further problems with your c# request but, unfortunately as Boris stated much of this requires deeper programming knowledge that what some of our technical support team is able to provide currently other than looking at it when we can.

    It is recommended to send our api team an email as suggested above to api@jotform.com and our API Team will then put you in touch with one of our devs that can likely assist you with it further.

    Additionally, I'll meet you half way on this subject by mentioning your thread here to our API Team on your behalf so that we can try to help you out more with it.