- Posts: 57
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Getting Token Value in Plugin
- sodiumchl
- Topic Author
- Offline
- Senior Member
Less
More
2 years 9 months ago - 2 years 9 months ago #217388
by sodiumchl
Getting Token Value in Plugin was created 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?
(LS version 3.x.x)
Code:
[code]$aReplacement=array('QID'=>$qid, 'GID'=>$gid, 'SGQ'=>$qCode); $tComp = strip_tags(LimeExpressionManager:ProcessStepString('{TOKEN:COMPLETED}',$aReplacement,3,1));
Last edit: 2 years 9 months ago by sodiumchl.
The topic has been locked.
- bismark
- Offline
- Senior Member
Less
More
- Posts: 70
- Thank you received: 15
2 years 9 months ago #217508
by bismark
Replied by bismark on topic Getting Token Value in Plugin
maybe `LimeExpressionManager::loadTokenInformation($sid, $token)`?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 9 months ago #217515
by DenisChenu
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.
Replied by DenisChenu on topic Getting Token Value in Plugin
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.
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.
The topic has been locked.
- sodiumchl
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 1
2 years 8 months ago #217809
by sodiumchl
Replied by sodiumchl on topic Getting Token Value in Plugin
> 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.
I am using it in beforeQuestionRender().
When I try LimeExpressionManager::loadTokenInformation($sid, $token), I get an error: $this undefined.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 8 months ago #217857
by DenisChenu
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.
Replied by DenisChenu on topic Getting Token Value in Plugin
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.
The topic has been locked.