Portal Filter

PeteM1
Tera Contributor

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.

1 ACCEPTED SOLUTION

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.

Claude E. D'Amico, III - CSA

View solution in original post

6 REPLIES 6

Claude DAmico
Kilo Sage

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.

Claude E. D'Amico, III - CSA

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. 

Would you mind providing a screenshot of where you have this filter?

Claude E. D'Amico, III - CSA

@Claude DAmico  Hey Claude, here is what I have for my SI. very easy and straight forward

 

PeteM1_0-1666214779547.png

This is my formula (Which will be moved to a portal)

 

javascript:lpb_script_library().lpb_script_library()

PeteM1_1-1666214942052.png

PeteM1_2-1666214996150.png

 

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.