(SRPL(sourcestring,searchstring,replacestring,[flag]))
Enables searching for and replacing text within a specified string of text.
sourcestring: Specifies a string of text to search.
searchstring: Specifies text to search for.
replacestring: Specifies the replacement text.
flag: 1--replacement occurs only if the matching string is a separate item of text.
0--every matching string is replaced.
The following example changes Dear Joe with Dear Anne:
UPDATE customer SET salutation = (SRPL(salutation,'Joe','Anne',1)) WHERE salutation CONT 'Dear Joe'
-----Original Message-----
From: Robert Garcia [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 11:26 AM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: Update action with <@replace>There are ways you can do this with complicated SQL statements. But the simplest method, is to do a search action first, where you retrieve the value of the column, and assign it to a variable, then you have a value to do your function on. So do a search action, followed by your replace method on the column value, then an update action on the same record with the new value for the column.
Does that make sense? The other method is to use variables inside a SQL statement, and you would have to use a SQL command for the replace action, not a witango tag. Either way it would require multiple dbms actions, so doing it with the above method should add very little overhead. To make it as efficient as possible, only retrieve the values you need in the search action, probably just the key and the url column. That should be a very quick retrieval.
Robert.
On Thursday, July 17, 2003, at 05:16 AM, Ted Wolfley wrote:
Doesn't the top portion of the update action do a search on the criteria that you specify? What I am trying to do is take the data from a column, change a portion of that data and replace the original data with the updated. The search criteria works, the problem is that I don't know how to specify the absolute value of the column being updated in the values section of the update action using <@replace>. In other words, what goes after "STR=" in the <@replace> tag to reference data in row of a column to be updated? I have also tried using the Direct_DBMS but with the same results.
Ted
-----Original Message-----
From: Ben Johansen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 4:10 PM
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Update action with <@replace>
The reason it works in rbase is due to the fact that you are within rbase when you run the update.
When you run an update action, witango is not aware of the values in the current column unless you query them in a search action prior to the update.
Ben Johansen - http://www.pcforge.com
Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm
Authorized MDaemon Mail Server Reseller
http://www.pcforge.com/AltN.htm
-----Original Message-----
From: Ted Wolfley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 12:55 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Witango-Talk: Update action with <@replace>
url is the name of the column I am trying to update, should I put <@column name='url'> instead?
The only thing constant in the columns' rows that I am trying to update is "&R=on&h=username&o=password1" and everything else before that can be different. The number of records needed to be updated is in the thousands.
I have tried it with <@REPLACE STR="<@column name 'url' encoding='METAHTML'>" FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>" >,
<@REPLACE STR="<@column name 'url' encoding='none'>" FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>" > and <@REPLACE STR="<@column name 'url' encoding='url'>" FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>" >in the update action without any luck.
In debug mode, the query results says I am setting the column to NULL.
I have done this with Rbase.
Ted
-----Original Message-----
From: Robert Garcia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 3:25 PM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: Update action with <@replace>
What is 'url'?
<@REPLACE STR=url FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>">
According to the above, the string is a constant 'url'. This should work (check encoding though):
<@assign local$url "http://website/results2.asp?u=244&R=on&h=username&o=password1">
<@REPLACE STR="@@local$url" FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>">
Robert.
On Wednesday, July 16, 2003, at 12:12 PM, Ted Wolfley wrote:
Hi,
I am trying to do an update on a column called url in a table. Each row in the column url is different and has data that looks like this:
http://website/results2.asp?u=244&R=on&h=username&o=password1
I would like to do an update that will only change "password1" to "password2" and everything else stay the same for that row like:
http://website/results2.asp?u=244&R=on&h=username&o=password2
I have tried using the update action with <@REPLACE STR=url FINDSTR="<@VAR vopassword>" REPLACESTR="<@VAR vnpassword>"> in the value colum of the acton. The variables"<@VAR vopassword>" is the orginal password and "<@VAR vnpassword>" is the new password.
I have also tried this with direct DMBS using:
UPDATE masterdetail SET url=''
The problem seems to be that witango is not seeing the data in the column. Is there way to do an update this way?
Thanks
Ted Wolfley
Database/Internet Programmer
The Ogden Group of Rochester
phone: (585) 321 1060 x23
fax: (585) 321 0043
[EMAIL PROTECTED]
--
Robert Garcia
President - BigHead Technology
CTO - eventpix.com
2781 N Carlmont Pl
Simi Valley, Ca 93065
ph: 805.522.8577 - cell: 805.501.1390
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/ - http://theradmac.com/
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
--
Robert Garcia
President - BigHead Technology
CTO - eventpix.com
2781 N Carlmont Pl
Simi Valley, Ca 93065
ph: 805.522.8577 - cell: 805.501.1390
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/ - http://theradmac.com/
________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
