/modules/formulize/include/extract.php
Gets the entry ids of the constituent entries that make up part of a dataset. Datasets can be made up of multiple entries, sometimes from multiple forms, and/or sometimes including multiple entries from the same form. For more information, see gatherDataset.
$entry - A single item in a dataset, generally one entry in the main form of the dataset, plus any connected entries from other forms in the relationship the dataset was based on. An entire dataset can be passed, and then the datasetKey parameter must be used to specify which item in the dataset you want to get entry ids for.
$formIdOrHandle - Optional. A form id or handle representing the form in the dataset that you want to get entry ids for. If not specified, entry ids of all entries in all forms that are part of this item are returned.
$datasetKey - Optional. If an entire dataset is passed in, then the number of the item in the dataset that you want to get ids for, must be specified. Items are numbered sequentially from 0. Generally this is not necessary and not used, because individual items within a dataset are passed to this function, see the examples.
$fidAsKeys - Optional. If formIdOrHandle was specified, then this will have no effect, because only that form’s entry ids will be returned. If the entry ids of multiple forms are returned, then setting this to true will cause the result array to be keyed with form ids. By default this is false and the result array is keyed with form handles.
Returns an array of the entry ids that make up this item in the dataset. If formIdOrHandle is specified, the array will be a single dimension array where every value is an entry id. If entry ids are being gathered from all forms in the dataset item, then the array will be multidimensional, and the outer level keys will be the form handles (or form ids if fidAsKeys is true), and then for each form there will be an array of the entry ids included from that form, as found in the dataset item that was passed in.
// gather all the data in form 6, plus connected forms in the Primary Relationship
$formId = 6;
$data = gatherDataset($formId);
// Iterate through the data and for each item in the dataset, print out the underlying entry ids
// from each form that are contained in that item in the dataset.
foreach($data as $entry) {
$entryIds = getEntryIds($entry);
foreach($entryIds as $formHandle=>$theseEntryIds) {
print "$formHandle is part of this item in the dataset, and the entry ids from that form which are included are:"
print implode(", ", $theseEntryIds); // turn the entry ids into a comma separated string
}
}
// gather all the data in form 6, plus connected forms in the Primary Relationship
$formId = 6;
$data = gatherDataset($formId);
// interate through the data and for each item in the dataset, get the entry ids that are included from form 11
foreach($data as $entry) {
$form11EntryIds = getEntryIds($entry, 11);
}