Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Manasa 41 posts 161 karma points
    Apr 03, 2018 @ 05:39
    Manasa
    0

    trying to fetch record data using form id

    Hello Everyone,

    I am trying to fetch the record data/form entry values using form id, I am getting "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first. " error.

    below is my code

    @foreach (dynamic record in Library.GetRecordsFromForm("52161654-5db5-4575-8e0c-1b52d50684f1")) {

     foreach (var field in record.RecordFields)
         {
    
                          <td>@field.Value.ValuesAsString()</td>
    
    
             }
    

    }

    ![enter image description here][1]

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 03, 2018 @ 09:45
    Dennis Aaen
    100

    Hi Manasa,

    Sorry to hear that you have issues with getting data from your form, when you are using Umbraco Forms.

    I have found a similar topic / thread on the form.

    See this thread - https://our.umbraco.org/forum/umbraco-forms/78207-working-with-record-data-there-is-already-an-open-datareader-associated

    Let me know if this also works for you.

    All the best,

    /Dennis

  • Manasa 41 posts 161 karma points
    Apr 04, 2018 @ 08:22
    Manasa
    0

    Hello Dennis,

    Thanks a ton for the solution.However i need to get the data with caption, now i am getting with some guid.can you please help.Thank you in advance.

    below is my output and the code

    Output: {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'} {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'} {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'}

    Goal:

    {'state':'No','Location':'Texas','Name':'abcdefg'}

    Code:

    @{ using (var formStorage = new FormStorage()) {

       using (var recordStorage = new RecordStorage())
       {
           var form = formStorage.GetForm(Guid.Parse("c710cc9e-9117-4103-b5b6-ba3c54a2921a"));
           var records = recordStorage.GetAllRecords(form).Where(x => x.UmbracoPageId == Model.Content.Id).ToList();
      foreach(var rec in records)
    {
        <h4>@rec.RecordData</h4>
    }
       }
    

    }

    }

  • aaeda 117 posts 150 karma points
    Sep 13, 2018 @ 06:30
    aaeda
    0

    Hello

    I am trying to use FormStorage but having the error message below:

    The type or namespace name 'FormStorage' could not be found (are you missing a using directive or an assembly reference?)

    Can you please advise?

    thanks

  • DL 2 posts 72 karma points
    Sep 13, 2018 @ 07:11
    DL
    0

    Hi. Missing : using Umbraco.Forms.Data.Storage; I assume. Regards.

  • aaeda 117 posts 150 karma points
    Sep 13, 2018 @ 07:12
    aaeda
    0

    Yes that's right thanks.

  • aaeda 117 posts 150 karma points
    Sep 13, 2018 @ 07:37
    aaeda
    0

    Hello

    I wanted to get the last submitted record id of a form on submit. Can you please advise how can this be done?

    Thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies