what is the easiest way to get all submitted records into a dataset of sorts? In XLST, you can use umbraco.contour:GetRecordsFromForm but, I can't find how/where to use this in code?
I have the following code, which does work, but I would rather fetch just the records for my specific form.
Cheers in advanced, Danny
Umbraco.Forms.Data.Storage.RecordStorage storage = new Umbraco.Forms.Data.Storage.RecordStorage(); var allRecords = storage.GetAllRecords();
Get all submitted records in code (not XLST)
Hi,
what is the easiest way to get all submitted records into a dataset of sorts?
In XLST, you can use umbraco.contour:GetRecordsFromForm but, I can't find how/where to use this in code?
I have the following code, which does work, but I would rather fetch just the records for my specific form.
Cheers in advanced,
Danny
Umbraco.Forms.Data.Storage.RecordStorage storage = new Umbraco.Forms.Data.Storage.RecordStorage();
var allRecords = storage.GetAllRecords();
List<Record> pollAnswers = new List<Record>();
foreach (var record in allRecords)
{
if (record.Form == new Guid(activePoll))
pollAnswers.Add(record);
}
Comment author was deleted
Hi Danny,
Take a look at this: http://www.nibble.be/?p=102
Wich are basicly some dynamic objects you can use, should make it easy
Hi Tim,
Thanks for the quick response:
ok, so I've tried:
foreach (dynamic record in Library.GetRecordsFromForm(activePoll))
{
string foo = record.Name;
}
it only loops once (I have 2 responses so far), and 'foo' is getting set to "uformrecords"
Am I missing anything?
Edit: I am doing this in the code-behind of a usercontrol, and not a cshtml file, so I can't use the razor markup.
Ok, Sorted now.
I hadn't downloaded the dll (DOH!) and was using a different library object.
Cheers
Danny
Comment author was deleted
great, glad it's working now
is working on a reply...