Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 8, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Replace does not work
Dan Carvin
Posts: 227
 
Replace does not workYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Mar 10 1:05 PM
I modifying some code in SLX 7.5.1 LAN which builds an SQL query and the VBScript "Replace" function does not seem to work.

Under certain circumstances I need to add an OR condition to the previous conditions in the query. Therefore I need to enclose the existing WHERE clauses in parentheses, then add the OR clause. I'm trying to do it like this:

If [conditions are present] Then
Replace strSQL," WHERE "," WHERE ("
strSQL = strSQL & ") OR [New condition]"
End if

This gets a "Failed to Parse SQL" error and SLXProfiler shows that closing paren and OR condition is added, but the opening paren is not added, which causes the error.

Why would this not work?
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Replace does not workYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Mar 10 1:35 PM
DOH!

That should be

strSQL = Replace(strSQL," WHERE "," WHERE (")

nevermind
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Replace does not workYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Mar 10 2:14 PM
The problem is that you're using Replace like a sub, expecting it to change the contents of the variable you pass in. It does not work this way, it is a function that returns the changed value.

So instead of this:

Replace strTest,"table","chair"


you must do this:

strTest = Replace(strTest,"table","chair")


It does not modify the contents of the variable, in your case strTest. It only returns the changed value which you must capture into a variable to use it.

Does that make sense?
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Replace does not workYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Mar 10 2:34 PM
yup, that's what I figured out minutes after posting the second message

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/8/2025 7:41:19 AM