Getting Token Value in Plugin

More
5 months 2 weeks ago - 5 months 2 weeks ago #217388 by sodiumchl
I'm trying to get the value of TOKEN:COMPLETED in a plugin. For some response, the following code gives me '2021-06-04 12:49' where as {TOKEN:COMPLETED} in an equation question gives me 'N'. (In the Responses table I also see No for Completed.) Why? How can I get the same result in php as in an equation question?
[code]$aReplacement=array('QID'=>$qid, 'GID'=>$gid, 'SGQ'=>$qCode);
$tComp = strip_tags(LimeExpressionManager:ProcessStepString('{TOKEN:COMPLETED}',$aReplacement,3,1));
(LS version 3.x.x)
Last edit: 5 months 2 weeks ago by sodiumchl.

Please Log in to join the conversation.

More
5 months 2 weeks ago #217508 by bismark
maybe `LimeExpressionManager::loadTokenInformation($sid, $token)`?

Please Log in to join the conversation.

More
5 months 1 week ago #217515 by DenisChenu
All token column name can be used (except participant_id because the are a _ in it) in TOKEN:
github.com/LimeSurvey/LimeSurvey/blob/d0...ger_helper.php#L3950

The question more : when you use this function ? In survey : it must work, elsewhere : must "load" survey before.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
5 months 23 hours ago #217809 by sodiumchl
> The question more : when you use this function?
I am using it in beforeQuestionRender().

When I try LimeExpressionManager::loadTokenInformation($sid, $token), I get an error: $this undefined.

Please Log in to join the conversation.

More
4 months 4 weeks ago #217857 by DenisChenu
No idea …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now