7/8/2025 6:32:39 AM
|
|
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!
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.
|
|
|
|
Replace does not work
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? |
|
|
|
Re: Replace does not work
Posted: 11 Mar 10 1:35 PM
|
DOH!
That should be
strSQL = Replace(strSQL," WHERE "," WHERE (")
nevermind |
|
|
|
Re: Replace does not work
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? |
|
|
| |
|
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!
|
|
|
|
|
|
|
|