Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Errors trying to import & overwrite in CPDB

  • coogle
  • coogle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 4 days ago #269187 by coogle
Hello all,

I am encountering a 500 server error when trying to upload a CSV that has custom attributes and I'd like to overwrite those attributes with the values from the CSV file. Here is the header of my CSV file:
Code:
participant_id,firstname,lastname,email,language,blacklisted,owner_uid,cohort,free

If I don't check the "Overwrite existing participant attribute values if a duplicate participant is found?" box the import succeeds. If I do and look at the network logs I see the following PHP error being returned (see below). This is on LimeSurvey 6.5.15. Any thoughts on how to fix this error would be greatly appreciated as we really need the ability to import and export custom attributes to make CPDB useful at all.
Code:
{
    "success": false,
    "message": "Property \"Participant.cohort\" is not defined.",
    "error": {
        "code": 500,
        "type": "CException",
        "errorCode": 0,
        "message": "Property \"Participant.cohort\" is not defined.",
        "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/db\/ar\/CActiveRecord.php",
        "line": 162,
        "trace": "#0 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/db\/ar\/CActiveRecord.php(162): CComponent->__set()\n#1 \/var\/www\/limesurvey\/application\/controllers\/admin\/ParticipantsAction.php(1037): CActiveRecord->__set()\n#2 [internal function]: ParticipantsAction->uploadCSV()\n#3 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CAction.php(114): ReflectionMethod->invokeArgs()\n#4 \/var\/www\/limesurvey\/application\/core\/SurveyCommonAction.php(83): CAction->runWithParamsInternal()\n#5 \/var\/www\/limesurvey\/application\/controllers\/admin\/ParticipantsAction.php(73): SurveyCommonAction->runWithParams()\n#6 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(308): ParticipantsAction->runWithParams()\n#7 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(286): CController->runAction()\n#8 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(265): CController->runActionWithFilters()\n#9 \/var\/www\/limesurvey\/application\/controllers\/AdminController.php(202): CController->run()\n#10 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php(282): AdminController->run()\n#11 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php(141): CWebApplication->runController()\n#12 \/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/base\/CApplication.php(185): CWebApplication->processRequest()\n#13 \/var\/www\/limesurvey\/index.php(161): CApplication->run()\n#14 {main}",
        "traces": [
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/db\/ar\/CActiveRecord.php",
                "line": 162,
                "function": "__set",
                "class": "CComponent",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/application\/controllers\/admin\/ParticipantsAction.php",
                "line": 1037,
                "function": "__set",
                "class": "CActiveRecord",
                "type": "->"
            },
            {
                "function": "uploadCSV",
                "class": "ParticipantsAction",
                "type": "->",
                "file": "unknown",
                "line": 0
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CAction.php",
                "line": 114,
                "function": "invokeArgs",
                "class": "ReflectionMethod",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/application\/core\/SurveyCommonAction.php",
                "line": 83,
                "function": "runWithParamsInternal",
                "class": "CAction",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/application\/controllers\/admin\/ParticipantsAction.php",
                "line": 73,
                "function": "runWithParams",
                "class": "SurveyCommonAction",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
                "line": 308,
                "function": "runWithParams",
                "class": "ParticipantsAction",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
                "line": 286,
                "function": "runAction",
                "class": "CController",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
                "line": 265,
                "function": "runActionWithFilters",
                "class": "CController",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/application\/controllers\/AdminController.php",
                "line": 202,
                "function": "run",
                "class": "CController",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php",
                "line": 282,
                "function": "run",
                "class": "AdminController",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php",
                "line": 141,
                "function": "runController",
                "class": "CWebApplication",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/vendor\/yiisoft\/yii\/framework\/base\/CApplication.php",
                "line": 185,
                "function": "processRequest",
                "class": "CWebApplication",
                "type": "->"
            },
            {
                "file": "\/var\/www\/limesurvey\/index.php",
                "line": 161,
                "function": "run",
                "class": "CApplication",
                "type": "->"
            }
        ]
    }
}
 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 days ago #269188 by holch
Before you try to hunt for bugs and how to fix it, update to the latest version which is somewhere around 6.10 and see if the problem has already been fixed. I don't think it males much sense to dig around in an outdated version. If the problem still exists in the latest version, then it makes sense to have a deeper look into this.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • coogle
  • coogle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 3 days ago #269197 by coogle
Replied by coogle on topic Errors trying to import & overwrite in CPDB
Been having trouble replying as the captcha doesn't seem to work. Either way, I upgrade to LS 6.10.2 and it made no difference here.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 days ago #269215 by holch
OK, so I assume the error is exactly the same. What I see is that the error is with "cohort", but not with any of the other custom attributes.

So the standard attributes in the CPDB seems to be:

Mandatory field: email
Optional fields: firstname, lastname,blacklisted,language

Did you setup "cohort" as a custom attribute?

What if you rename it?

What if you delete it?

Does Limesurvey allow the other custom attributes to be imported?

Because given that your CSV looks like this "participant_id,firstname,lastname,email,language,blacklisted,owner_uid,cohort,free" the first custom attribute seems to be "owner", maybe even "participant_id". So if the error only comes with "cohort", my suspicion is that the problem is not so much with custom attributes, but with cohort in specific.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • coogle
  • coogle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 days ago #269217 by coogle
Replied by coogle on topic Errors trying to import & overwrite in CPDB
Code:
participant_id
and
Code:
owner_uid
are both LimeSurvey fields. I exported the CPDB, added two new custom attributes to that .csv file, and then tried to reimport (this is all because I don't think it's possible to create an attribute for an existing list of CPDB members with a default value for already existing members).

There are two custom attributes I have created:
Code:
cohort
and
Code:
free
, I have attempted a few different ways of doing this:
  • Creating the attribute in the UI, then importing values for it from CSV
  • Not having the attribute in the UI, and creating it using the import tool
In all circumstances, if I do not select "Overwrite existing" when I do the import no attributes are created for existing members of CPDB. If I do select "Overwrite Existing", I get this error. The only way I can import a custom attribute, it seems, is to delete all participants from the CPDB and import them all as brand new participants (this works).

As for the problem being "cohort" -- You wouldn't see the error for other custom attributes because this error causes the PHP script to halt. Certainly it is not expected behavior to throw an error like this depending on the name of the attribute. Perhaps you could explain a bit more to help me understand what you are suggesting I do -- especially considering a few of these fields are directly from the LS export?

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 days ago #269218 by holch
I am not a developer nor a frequent user of CPDB, I am just trying to narrow things down and see if it is a bug or something else.

I had opened the CPDB (which I basically never use) and have seen the standard fields being:

Mandatory field: email
Optional fields: firstname, lastname,blacklisted,language


So I assumed all others are custom attributes, which according to you is not the case. So yes, "cohort" probably creates the error, because it is the first thing that LS has a problem with.

I will give it a try and try to reproduce this here.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose