- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 05:50 AM
Hello All. I am currently having an issue with a filter in a datatable portal widget.
I have a simple script includes that returns the value 'xxxxxxxxxxxx'
getFilterValue: function(){
return 'xxxxxxxxxxxx';
}
I call the script includes from the filter using pid=:javascript new scriptincludename().getFilterValue();
In every case I try, I get a NULL value.
Any thoughts? Can I no use a script include in this way?
Thank you in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2022 06:44 AM
That's very helpful! For a script include being a single function, cut the javascript part in the filter down to just javascript:lpb_script_library() so it isn't trying to look for a sub-function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 08:13 AM
If that's the syntax you are using, it's not correct. In the condition builder, you would have [pid][is][javascript: new scriptincludename().getFilterValue()]. So move the colon to the other side of the word javascript.
Another thing is something I've noticed when doing this myself. I had difficulties making that format of script include work for a filter so I ended up creating the whole SI as a single function without the initial stuff below:
var scriptInclude = Class.create();
scriptInclude.prototype = {
So it just looked like this:
//Name of Script Include and function match
function getFilterValue() {
//do something;
}
That made me change how it was called in the filter to field=javascript: scriptInclude()
I hope some of this points you in the right direction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 09:31 AM
Hello @Claude DAmico and thank you for the response.
As for the colon -- I have it correct in the code. I just had a typo in my message
I've tried
pid=javascript: new nameofsi().nameoffunc();
pid is javascript: new nameofsi().nameoffunc()
[pid] [is] [javascript: new nameofsi().nameoffunc()]
Then I created a new SI using something similar to what you have
function getFilterValue() {
return 'xxxxxxxx';;
}
Nothing else in the code. Just those three lines
then pid=javascript:SIName().functionname();
Each time I get pID=NULL.
In the log I get a javascript:SIName().functionname() not defined error message
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 12:22 PM
Would you mind providing a screenshot of where you have this filter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 02:31 PM - edited 10-19-2022 02:47 PM
@Claude DAmico Hey Claude, here is what I have for my SI. very easy and straight forward
This is my formula (Which will be moved to a portal)
javascript:lpb_script_library().lpb_script_library()
I've also used:
var lpb_scriptIncluds = Class.create();
lpb_scriptIncluds.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
returnKey: function(){
return 'APA0001003';
},
type: 'lpb_scriptIncluds'
});
Hope this is enough info. I had to recreate it at home.