pipe - 如何根据同一仪器中先前的复选框结果自动填充 REDCap 复选框

标签 pipe autofill redcap

我想根据同一仪器中先前字段的结果自动填写调查复选框。就我的示例而言,如果受访者使用红色工具包,我希望他们在最初的工具包问题中​​选择"is",因此有关哪些类型工具的后续复选框字段已得到回答,以节省填写所有工具包的时间。在工具包中。

this is the field set up. Once kit 'Yes' is selected, I want red hammer and nails to be automatically selected

我了解如何使用 @DEFAULT='[前一个字段名称]' 对文本字段执行此操作,但我无法使此操作适用于复选框。将 @DEFAULT='[kit]' 添加到锤子或钉子使用字段中不会导致自动填充选择。如果该操作可以是有条件的,那就太好了,就像如果为套件选择"is"那么锤='1',否则它将留空。

最佳答案

请参阅有关管道的内置帮助和常见问题解答:

If you are piping the answer FROM a multiple choice field (radio, drop-down), it will display the option label (not the coded data value) into the location where the field is piped. For example, if you had a drop-down question that said 'What is your favorite ice cream?' with the choices 'Chocolate', 'Vanilla', and 'Strawberry' (all coded as 0, 1, 2, respectively), then after selecting 'Chocolate', the next question would read 'On a scale of 1 to 10, how much to you like Chocolate?'.

But for non-multiple choice fields, such as Text, Notes, Slider fields, it will pipe the literal data value. If you wish to pipe the value (not the label) of a multiple choice field, append ':value' to the variable name inside brackets - e.g., [race:value].

Note: The usage of ':value' must be used if piping inside the @DEFAULT Action Tag if you would like to pipe the value of a multiple choice field as the default value of a field.

从分类字段(单选、下拉列表等)进行管道传输的默认行为是通过管道传输标签(示例中的文本"is")。但是,您正在使用的复选框字段 @DEFAULT将值传入的操作标记,期望选择代码(值)。幸运的是,有一个选项可以使用 [field:value] 管道传输值而不是标签。 .

所以添加@DEFAULT='[kit:value]'到你的锤子/钉子领域就是你想要的。

但是还有一个问题; @DEFAULT在页面加载时进行评估,因此无法使用数据库中的值根据调查或表单当前页面中的答案动态选择默认值。如果当前页面中的值不在数据库中,则无法使用它们。

通常,这是通过用分页符分隔两个字段来解决的(仪器中的新部分字段,在调查设置中启用了“每页一个部分”选项)。这样,[kit]的值当用户单击“下一页”时,将提交到数据库,并且 @DEFAULT然后可以从数据库读取该值并使用它自动选择复选框选项之一。

最后一个考虑因素是,[套件] 字段和锤子/钉子字段中的编码值必须兼容。如果1, Yes对应于锤子和钉子的“红色”,那么这些复选框中的“红色锤子”和“红色钉子”选项应编码为 1@DEFAULT无法执行任何计算或评估任何逻辑,因此您不能用它来表达“如果选择套件的"is"则锤子 = 1,否则将其留空”之类的内容;相反,它的工作原理是采用单个参数,并在页面加载和构造字段时使用该参数自动选择选项(或者如果它是文本输入字段,则将参数作为文本插入)。此过程中没有评估任何逻辑的范围。

关于pipe - 如何根据同一仪器中先前的复选框结果自动填充 REDCap 复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67066980/

相关文章:

redcap - 计算字段 - 使用数字 e 的公式

c - 重定向标准流

excel - 根据 Excel 表格的另一列自动填充列

c# - 如何使用 Excel.Interop 将列表中的值填充到 Excel 中的一系列单元格?

zend-framework - Zend 框架 : Post to different action then return to original action if fails validation AND keep form fields

r - 如何使用redcapAPI包中的exportRecordsTyped函数导入不带因素的数据?

c - 如何重新打开一个关闭的文件描述符

javascript - 带编号的 Angular 定制管

C++将字符串传递到管道中以传递给gnuplot

android - Android 中的 REDCap API 导入记录