Skip to content

Commit

Permalink
Doc updates, bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lsgs committed Nov 13, 2023
1 parent 233b653 commit 0c7b998
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
9 changes: 4 additions & 5 deletions InstanceTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class InstanceTable extends AbstractExternalModule
const ACTION_TAG_VARLIST = '@INSTANCETABLE_VARLIST'; // provide a comma-separated list of variables to include (not including any tagged HIDE)
const ACTION_TAG_PAGESIZE = '@INSTANCETABLE_PAGESIZE'; // Override default choices for page sizing: specify integer default page size, use -1 for All
const ACTION_TAG_REF = '@INSTANCETABLE_REF';
const ACTION_TAG_SRC = '@INSTANCETABLE_SRC'; // deprecated
const ACTION_TAG_DST = '@INSTANCETABLE_DST'; // deprecated
const ACTION_TAG_FILTER = '@INSTANCETABLE_FILTER';
const ADD_NEW_BTN_YSHIFT = '0px';
const MODULE_VARNAME = 'MCRI_InstanceTable';
Expand Down Expand Up @@ -835,11 +837,9 @@ public function redcap_every_page_before_render($project_id) {
if (isset($_POST['extmod_closerec_home'])) {
$_SESSION['extmod_closerec_home'] = $_POST['extmod_closerec_home'];

} else if (PAGE==='DataEntry/index.php' && isset($_GET['extmod_instance_table']) && isset($_GET['extmod_instance_table_add_new'])) {
global $Proj, $lang, $user_rights;
} else if (PAGE==='DataEntry/index.php' && isset($_GET['extmod_instance_table']) && isset($_GET['extmod_instance_table_add_new']) && !is_null($project_id) && isset(($_GET['event_id']))) {
global $Proj;
$this->Proj = $Proj;
$this->lang = &$lang;
$this->user_rights = &$user_rights;
$this->isSurvey = false;
// adding new instance - read current max and redirect to + 1
$formKey = ($this->Proj->isRepeatingEvent($_GET['event_id']))
Expand All @@ -856,7 +856,6 @@ public function redcap_every_page_before_render($project_id) {
} else {
$_GET['instance'] = 1;
}

}
}
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# REDCap External Module: Instance Table

Luke Stevens, Murdoch Children's Research Institute https://www.mcri.edu.au

[https://github.com/lsgs/redcap-instance-table](https://github.com/lsgs/redcap-instance-table)
********************************************************************************
## Summary

Use the action tag `@INSTANCETABLE=form_name` in a descriptive text field to include a table showing data from repeat instances of that form.

If project is longitudinal, use `@INSTANCETABLE=event_name:form_name` to specify the event and form (can be a repeating form or a form in a repeating event). Event defaults to current event if not specified.
Expand Down
42 changes: 19 additions & 23 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,46 @@
"institution": "Murdoch Children's Research Institute"
}
],
"description": "Use the action tag @INSTANCETABLE=form_name in a descriptive text field to include a table showing data from repeat instances of that form.<br>If project is longitudinal, use @INSTANCETABLE=event_name:form_name to specify the event and form (can be a repeating form or a form in a repeating event).",
"framework-version": 14,
"compatibility": {
"redcap-version-min": "13.4.12"
},
"action-tags": [
"description": "Use the action tag <code>@INSTANCETABLE=form_name</code> in a descriptive text field to include a table showing data from repeat instances of that form.<br>If project is longitudinal, use <code>@INSTANCETABLE=event_name:form_name</code> to specify the event and form (can be a repeating form or a form in a repeating event).<br>Other action tags are available for controlling cetain properties of te tables and their contents.",
"framework-version": 14,
"action-tags": [
{
"tag": "@INSTANCETABLE",
"description": "Tag @INSTANCETABLE=form_name in a descriptive text field to include a table showing data from repeat instances of that form."
"description": "Tag <code>@INSTANCETABLE=form_name</code> in a descriptive text field to include a table showing data from repeat instances of that form."
},
{
{
"tag": "@INSTANCETABLE_HIDE",
"description": "Tgnore this field in instance all tables."
"description": "Ignore this field in instance all tables."
},
{
{
"tag": "@INSTANCETABLE_LABEL",
"description": "Tag @INSTANCETABLE_LABEL='column header': Provide an alternative column title for the field in all instance tables."
},
{
{
"tag": "@INSTANCETABLE_HIDEADD",
"description": "Tag suppress the 'Add New' button."
"description": "Suppress the \"+ Add New\" button on data entry forms."
},
{
{
"tag": "@INSTANCETABLE_HIDEINSTANCECOL",
"description": "Hide the '#' column containing instance numbers."
},
{
{
"tag": "@INSTANCETABLE_VARLIST",
"description": "Tag @INSTANCETABLE_VARLIST=rptfrmvar3,rptfrmvar1,rptfrmvar6,rptfrm_complete: Include only the variables from the repeating form that appear in the comma-separated list. Also (from v1.5.1) can be used to set the order of columns in the table rather than using the order of fields from the form."
"description": "Use, for example, <code>@INSTANCETABLE_VARLIST=rptfrmvar3,rptfrmvar1,rptfrmvar6,rptfrm_complete</code> to include only the variables from the repeating form that appear in the comma-separated list. Also sets the order of columns in the table rather (default is the order of fields from the form)."
},
{
{
"tag": "@INSTANCETABLE_PAGESIZE",
"description": "Override default choices for page sizing: specify integer default page size, or -1 for 'All'"
},
{
{
"tag": "@INSTANCETABLE_REF",
"description": "Tag @INSTANCETABLE_REF=fieldname: Where you have an instance table on a repeating form - i.e. is referencing another repeating form - you can have the instances filtered to show only those where the current instance number is saved in a field on the other form. For example, an instance table in a repeating 'Visit' form may be configured to show only instances of the repeating 'Medication' form where the current Visit instance is selected in the visitref field on the Medication form: @INSTANCETABLE @INSTANCETABLE_REF=visitref."
"description": "Where you have an instance table on a repeating form that is referencing another repeating form, use <code>@INSTANCETABLE_REF=fieldname</code> to have the instances filtered to show only those where the current instance number is saved in a field on the referenced repeating form. For example, an instance table in a repeating 'Visit' form may be configured to show only instances of the repeating 'Medication' form where the current Visit instance is selected in the visitref field on the Medication form: <code>@INSTANCETABLE @INSTANCETABLE_REF=visitref</code>."
},
{
{
"tag": "@INSTANCETABLE_FILTER",
"description": "Tag @INSTANCETABLE_FILTER='[v]=1': Specify a logic expression to show only instances that match the filter expression."
"description": "Use <code>@INSTANCETABLE_FILTER='[v]=1'</code> to specify a logic expression to show only instances that match the filter expression."
}
],
"enable-every-page-hooks-on-system-pages": false,
"system-settings": [ ],
],
"system-settings": [ ],
"project-settings": [ ]
}

0 comments on commit 0c7b998

Please sign in to comment.