Copied to clipboard

Flag this post as spam?

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


  • Greg 9 posts 29 karma points
    Jan 30, 2015 @ 22:38
    Greg
    0

    Umbraco 7.2 + Forms 4.0.1: what is new mechanism for retrieving a single record?

    Documentation is light on this topic, and while I have access to recordid in TempData with 4.0.1, I don't see how to retrieve the data for a the submitted form.

    Using this to obtain the formId and recordId works.

    var formId = "bcc50f76-84eb-4e37-9ab2-dc9401ad6c09";
    var recordId = TempData["Forms_Current_Record_id"];

    This works to retrieve and review the Record data.

    foreach (dynamic record in Library.GetRecordsFromForm(@formId))
    {
    <div>Records</div>
    try
    {
    <div>
    <ul>
    <li>Created:: @record.Created</li>
    <li>Form:: @record.Form</li>
    <li>Id:: @record.Id</li>
    <li>IP:: @record.IP</li>
    <li>MemberKey:: @record.MemberKey</li>
    <li>State:: @record.State</li>
    <li>UmbracoPageId:: @record.UmbracoPageId</li>
    <li>Updated:: @record.Updated</li>
    </ul>
    </div>
    }
    catch (Exception e)
    {
    <div style="color:red">@e.Message</div>
    }
    }

    The Record.Id being returned is an INT and not a GUID, so how does one line up the two and retrieve the correct data?

    Is there another location in memory which is storing the Record.Id?

     

  • Greg 9 posts 29 karma points
    Jan 31, 2015 @ 00:26
    Greg
    0

    I've found a short-term hack which doesnt rely on simply selecting the last record returned.

    Long term this could be a problem if I have 50k records and I'm iterating over every record returned.

    Looking at the database in dbo.UFRecords, I was able to find a field not detailed in the documentation, UniqueId. With this I can at least match up the proper data, but again, this is not a viable permanent solution. A comment on what is "proper" or another method being exposed which returns a single record would be helpful.

    string recordIdString = TempData["Forms_Current_Record_id"].ToString();
    var recordIdGuid = new Guid(recordIdString);
    var recordSet = Library.GetRecordsFromForm(@formId);
    foreach (dynamic record in recordSet)
    {
    try
    {
    if (record.UniqueId == recordIdGuid) {
    <div>
    <ul>
    <li>Created:: @record.Created</li>
    <li>Form:: @record.Form</li>
    <li>Id:: @record.Id</li>
    <li>IP:: @record.IP</li>
    <li>MemberKey:: @record.MemberKey</li>
    <li>State:: @record.State</li>
    <li>UmbracoPageId:: @record.UmbracoPageId</li>
    <li>Updated:: @record.Updated</li>
    <li>UniqueId:: @record.UniqueId</li>
    </ul>
    </div>
    }
    }
    catch (Exception e)
    {
    <div style="color:red">@e.Message</div>
    }

  • Dan Mulholland 2 posts 22 karma points
    Jul 29, 2015 @ 15:15
    Dan Mulholland
    0

    Hi, did you ever find a solution to this issue? I'm anticipating a lot of records so eager for a longer term solution

Please Sign in or register to post replies

Write your reply to:

Draft