- Posts: 111
- Thank you received: 20
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Extending EM with own function
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
9 years 9 months ago - 9 years 9 months ago #110399
by orvil
Best regards/Beste Grüße,
O. Villani
Extending EM with own function was created by orvil
Hi all,
I'd like to extend the EM by some own funtions for csv-strings (like '1;01.01.2015;Hello World'). Found some info at [url=http://http://manual.limesurvey.org/Expression_Manager_for_developers]Expression Manager for developers[/url]
It's working fine with the php part of the code (em_core_helper.php). So an added function like
works fine and gives back what is expected (eg by calling csvgetdata(';', '1;01.01.2015;Hello World', 3) it gives back 'Hello World'
Now my annoying :woohoo: problem:
Obviously for relevance equations the javascript part of the code is required (is this correct?)
I tried to add functions at em_javascript.js, but nothing happens. Even the simple function
does not work for the relevance equation. Is there anything to add at other files? The description at 'Expression Manager for Developers' does not mention anythig about this.
Hope there is someone for help.
Thanks in advance
I'd like to extend the EM by some own funtions for csv-strings (like '1;01.01.2015;Hello World'). Found some info at [url=http://http://manual.limesurvey.org/Expression_Manager_for_developers]Expression Manager for developers[/url]
It's working fine with the php part of the code (em_core_helper.php). So an added function like
Code:
csvgetdata(separator, datastring, item)
Now my annoying :woohoo: problem:
Obviously for relevance equations the javascript part of the code is required (is this correct?)
I tried to add functions at em_javascript.js, but nothing happens. Even the simple function
Code:
function testme() { return 1; }
does not work for the relevance equation. Is there anything to add at other files? The description at 'Expression Manager for Developers' does not mention anythig about this.
Hope there is someone for help.
Thanks in advance
Best regards/Beste Grüße,
O. Villani
Last edit: 9 years 9 months ago by orvil.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
9 years 9 months ago #110419
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 Extending EM with own function
em_core_helper.php
And try with return 'test' maybe.
Code:
$this->RDP_ValidFunctions = array( ...... 'emFunctionName' => array('phpFunction', 'jsFunction', gT('Some explanation'), 'another explanatuion', 'a link', $numberOfArg}
And try with return 'test' maybe.
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 following user(s) said Thank You: orvil
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
9 years 9 months ago #110421
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Extending EM with own function
Hi Denis,
thanks, of course I did this already - but with no effect. I had a look at Firebug, I think it's maybe a cache problem. Yesterday it did not work even with emptying the cache, today its working. But I'm not shure about the behaviour.
Is there some information to find when and where either the php or the js part of EM code ist used?
THX
thanks, of course I did this already - but with no effect. I had a look at Firebug, I think it's maybe a cache problem. Yesterday it did not work even with emptying the cache, today its working. But I'm not shure about the behaviour.
Is there some information to find when and where either the php or the js part of EM code ist used?
THX
Best regards/Beste Grüße,
O. Villani
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
9 years 9 months ago #110430
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 Extending EM with own function
EM code (and file ) is really hard to debug and understand.
But the last time i add a function, i do like this witout problem.
Maybe a js issue ?
May a php issue
Don't know.
To debug limesurvey, you can use tracevar function (and look at your console.log)
Denis
But the last time i add a function, i do like this witout problem.
Maybe a js issue ?
May a php issue
Don't know.
To debug limesurvey, you can use tracevar function (and look at your console.log)
Denis
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.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
9 years 9 months ago #110453
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Extending EM with own function
It was indeed a cache problem. I don't know why an how, but after restarting things are working fine
Thanks for the debug tip!
btw: is there a way to make own EM-functions update-save or/and to share them?
Thanks for the debug tip!
btw: is there a way to make own EM-functions update-save or/and to share them?
Best regards/Beste Grüße,
O. Villani
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
9 years 9 months ago #110461
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 Extending EM with own function
Hi,
Not actually, but i'm sure a future release have EM function in Plugin.
You can work on this project if needed, maybe put a Feature Request for this.
Denis
Not actually, but i'm sure a future release have EM function in Plugin.
You can work on this project if needed, maybe put a Feature Request for this.
Denis
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.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
9 years 9 months ago #110516
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Extending EM with own function
Yes, good idea. Unfortunately I cannot do it by myself at the moment, no free time for that and the new organize view for 2.06 is still open on my shedule
But I'd like to share the csv functions then. Found some other post where this could be a solution.
But I'd like to share the csv functions then. Found some other post where this could be a solution.
Best regards/Beste Grüße,
O. Villani
The topic has been locked.