Difference between revisions of "Pandora Filter Examples"

From SmartWiki
Jump to: navigation, search
(Created page with ' ==Escaping Apostrophes== When searching a text field that may contain an apostrophe (') you need to add a backslash in front of the apostrophe so it is not interpreted as closin…')
 
Line 1: Line 1:
 
 
==Escaping Apostrophes==
 
==Escaping Apostrophes==
 
When searching a text field that may contain an apostrophe (') you need to add a backslash in front of the apostrophe so it is not interpreted as closing the text string:
 
When searching a text field that may contain an apostrophe (') you need to add a backslash in front of the apostrophe so it is not interpreted as closing the text string:
Line 5: Line 4:
 
   var filter = " name='"+frm.cname.value.replace(/'/g,"\\'")+"'";
 
   var filter = " name='"+frm.cname.value.replace(/'/g,"\\'")+"'";
  
 +
* This filter will look for Level 3s attached to the current level 2 with a value from the variable "exType" in the custom field 1301787:
 +
  var filter="objectid='@objectid@' and tbl_1301787.valuestr="+exType;
  
  
 
[[Category:Pandora]]
 
[[Category:Pandora]]

Revision as of 18:04, 29 January 2011

Escaping Apostrophes

When searching a text field that may contain an apostrophe (') you need to add a backslash in front of the apostrophe so it is not interpreted as closing the text string:

  • The following filter can be used to search the company name field for the name in the cname field on the page.
  var filter = " name='"+frm.cname.value.replace(/'/g,"\\'")+"'";
  • This filter will look for Level 3s attached to the current level 2 with a value from the variable "exType" in the custom field 1301787:
 var filter="objectid='@objectid@' and tbl_1301787.valuestr="+exType;