Dennis
That would really stretch my head and hurt for months.
I have about 25 fields that I want to SRPL and each of these fields may be
used
3-4 times in the text. That would be a major head stretcher to me.
It seems I can come up with strange needs in my app.
Thanks
Marc
----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, January 14, 2009 11:17 AM
Subject: [RBASE-L] - RE: SRPL limit?
Mark,
Why not populate a table with columns FindText and NewText.
Declare a cursor on this table and loop through, +
calling my code each time.
Would this work for you?
Dennis
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Wednesday, January 14, 2009 10:29 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?
Jim
By George I think you got it
I only had a time for a quick text but it look OK so far.
I am about 1/2 way through adding Dennis's suggestion
now I may have 2 choices.
Thanks
Marc
----- Original Message -----
From: "James Bentley" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, January 14, 2009 8:37 AM
Subject: [RBASE-L] - RE: SRPL limit?
If you want to replace something with null try the following syntax:
SET VAR vadjdesc4 = +
(SRPL(.vadjdesc3,'[sx2]',(IFNULL(.vsympt2,NULL ,.vsympt2)) ,1))
use the keyword NULL
Jim Bentley
American Celiac Society
[email protected]
tel: 1-504-737-3293
----- Original Message ----
From: MDRD <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Tuesday, January 13, 2009 7:15:43 AM
Subject: [RBASE-L] - RE: SRPL limit?
Thanks Dennis, Larry, Karen, Stephen, Bill and all for the help
Not sure why I thought of that. I just got lucky.
Thanks Marc
----- Original Message ----- From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 5:53 PM
Subject: [RBASE-L] - RE: SRPL limit?
oooo, tricky Mark.
but just to avoid confusion over terminology, use vNoText instead of
vNull.
CHAR(0) is not null but actually a ZERO length text.
Dennis
________________________________________
From: [email protected] [[email protected]] On Behalf Of MDRD
[[email protected]]
Sent: Monday, January 12, 2009 3:52 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?
Ok
I think I found the answer.
set var vnull = '' did not work soo I tried this and it seems to work
SET VAR vnull TEXT = (CHAR(0))
SET VAR vadjdesc4 = +
(SRPL(.vadjdesc3,'[sx2]',(IFNULL(.vsympt2,.vnull ,.vsympt2)) ,1))
Thanks All
Marc
----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 2:41 PM
Subject: [RBASE-L] - RE: SRPL limit?
Marc,
Well it looks like you need a little stretching!
It doesn't hurt.
Put my code in a file and run it.
You will see the result = ac, b has been replaced with nothing
Try it with vRepl = a or b or c or x
You will see the results.
It is doing the SRPL the hard way, by grabbing the texts before and after
the Find text and inserting the replace text between them.
Look up the functions I've used in help so you understand them.
Trace it and watch the variables.
I think you will get the idea
Dennis
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 2:25 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?
Dennis
Thanks for the code, sad to say you are still stretching me with that
example.
SRPL still seems much easier in my mind.
I will have to get a strong cup of coffee and study this some more.
Marc
----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 2:03 PM
Subject: [RBASE-L] - RE: SRPL limit?
Marc,
You can create your own custom functions for RBase to use.
Not withstanding that, here is some sample code on how work around the
SRPL
problem. This method works whether your replacement value is null or not
SET VAR vTmp = 'abc' -- original text
SET VAR vFind = 'b' -- Text to find
SET VAR vRepl TEXT = NULL -- text to substitute
SET VAR vPos INTEGER
SET VAR vLen INTEGER
SET VAR vPre TEXT
SET VAR vPost TEXT
SET VAR vPos = (SLOC(.vTmp,.vFind))
IF vPos > 0 THEN
SET VAR vLen = (SLEN(.vFind))
SET VAR vPre = (SGET(.vTmp,(.vPos-1),1))
SET VAR vPost = (SGET(.vTmp,(SLEN(.vTmp)),(.vPos+.vLen)))
SET VAR vTmp = (.vPre+.vRepl+.vPost)
ENDIF
SHOW V vTmp
RETURN
Dennis McGRath
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 1:37 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?
Dennis
You and Larry are talking over my head and give me too much credit.
Marc
----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 1:15 PM
Subject: [RBASE-L] - RE: SRPL limit?
I think one of your best bets is to do as Larry suggested and make you own
function (stored procedure) that you can call.
I suspect someone on this list already has such a function written.
Dennis
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 12:27 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?
Dennis
I thought of that but extra spaces would look bad in the paragraph.
It seems I can come up with some strange needs in my APP.
Marc
----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 12:16 PM
Subject: [RBASE-L] - RE: SRPL limit?
Bummer,
As far as I can tell, it has worked that way for some time.
It does limit the usefulness of this function quite a lot.
You could change himer to a space but that may not be what you want.
Dennis McGrath