Dynamic Encoded Query

Tarasingh26
Tera Expert

Hi ,

 

I have written below script in relationship. But it is not giving proper results. Where could be issue?

 

(function refineQuery(current, parent){

var trendWord=current.getValue('u_trending_word');

current.addEncodedQuery('nameLIKE' +trendWord+ '^ORdescriptionLIKE'+trendWord);

 

})(current, parent)

 

Thanks,

Tara Singh

1 ACCEPTED SOLUTION

Phanindra N
Tera Guru

Relation ship should be defined between two tables, where I cannot see the value from parent table to establish the relationship. I am assuming 'u_trending_word' is on parent table. Then the script should be

 

var trendWord= parent.u_trending_word;

current.addEncodedQuery('nameLIKE' +trendWord+ '^ORdescriptionLIKE'+trendWord);

 

Plz let me know if it works. If this doesn't work need more information to debug on this.

View solution in original post

3 REPLIES 3

Samaksh Wani
Giga Sage
Giga Sage

Hello @Tarasingh26 

 

It seems you are using AND OR at the same time Your encoded Query should be :-

 

current.addEncodedQuery('nameLIKE' +trendWord+ ^NQdescriptionLIKE'+trendWord);

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

 

Phanindra N
Tera Guru

Relation ship should be defined between two tables, where I cannot see the value from parent table to establish the relationship. I am assuming 'u_trending_word' is on parent table. Then the script should be

 

var trendWord= parent.u_trending_word;

current.addEncodedQuery('nameLIKE' +trendWord+ '^ORdescriptionLIKE'+trendWord);

 

Plz let me know if it works. If this doesn't work need more information to debug on this.

Thanks @Phanindra N . This is working. Really appreciate your help.