- Posts: 70
- Thank you received: 15
Ask the community, share ideas, and connect with other LimeSurvey users!
function getColumnName($response, $title) { $fieldmap = createFieldMap($response->survey, 'full', null, false, $response->attributes['startlanguage']); foreach ($response->attributes as $key => $value) { if (array_key_exists($key, $fieldmap)) { if (array_key_exists('title', $fieldmap[$key]) && $fieldmap[$key]['title'] === $title) { return $key; } } } return false; }
Yii::import('application.helpers.common_helper', true); $response = SurveyDynamic::model(123456)->findByPk(1); var_dump(getColumnName($response, 'completed')); // outputs '454344X20X386'