Normal Topic Retrieve for LineFeed, and search/replace (Read 1772 times)
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Retrieve for LineFeed, and search/replace
Dec 8th, 2018 at 6:41am
Print Post Print Post  
I have a database with 40,000 records that a field that can only have a max char count of 100 chars.  Not a problem, except this is a new spec, and most records exceed that value.

The data was entered in a multi line box that accepted RTN codes The box has been reshaped to be a sinlge line of 100 chars, vs. the multiline format that had unlimited lines.  This part of the effort to eliminate using the RTN code.  No line wrapping.

The new layout shows the ^J character for the old line feeds, and seems to be a changing value of spaces.  If I manually delete the ^J my char count comes down dramatically, so the length frequently fits, means less editing.

So now I need to do a Search/Replace.

But I now have two problems:
1. I cannot retrieve records that have a ^J
I have tried CTL-J, ^J, @LF, @CHR(10) with and without { } braces

2. I cannot find a value to use in the @Replace formula, @Replace(Field,^J," ") and @Replace(Field,"^J"," ") with above variations.


I have tried the same values from above in the Search part of the @Replace function. 

I tried copying the ^J char from the box and pasting that into my Retrieve and Replace attempts.

I am sure this will be an easy fix, but am stymied so far.
  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Retrieve for LineFeed, and search/replace
Reply #1 - Dec 8th, 2018 at 5:08pm
Print Post Print Post  
I wonder if you could take the text as a multi-line feed where it shows the extra information like the ^J then send that through a loop where it replaces the @Chr(10) with an @Chr(8), a backspace, then take the newly processed information and FormFieldValue it back in to the corresponding field.
  
Back to top
 
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Retrieve for LineFeed, and search/replace
Reply #2 - Dec 9th, 2018 at 5:52am
Print Post Print Post  
Thanks actiontech, but I tried to do a  Mass Update on a single record, and @Replace (FieldName,@CHR(10)," ") does not work.  Don't see how @Replace (FieldName,@CHR(10),@CHR(8)) will work.

Or maybe I am misunderstanding? 
Are you saying to add a new temp multiline field.
Then make that new multiline field the existing text field value with the ^J.
And then try the @Replace, and send it back to the text field.

Like this:
Code
Select All
NewMultiLineField = TextField

TextField = @Replace(NewMultiLineField,@CHR(10),@CHR(08))
OR
NewMultiLineField = @Replace(NewMultilineField,@CHR(10),@CHR(08))
TextField = @FormFieldValue("FormName","NewMultilineField",0)
 


Then remove the temp new multiline field?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Retrieve for LineFeed, and search/replace
Reply #3 - Dec 10th, 2018 at 3:11pm
Print Post Print Post  
To search for a Line feed in a field named Company use the following at the retrieve spec:

Code
Select All
{@Instr(Company, @Chr(10)) > 0} 



To replace a line feed in the data of the field Company use the following in a Mass Update:

Code
Select All
Company = @Replace(Company, @Chr(10), " ") 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Retrieve for LineFeed, and search/replace
Reply #4 - Dec 10th, 2018 at 6:57pm
Print Post Print Post  
Thanks Ray.

I figured out the same retrieve spec over the weekend and it works fine.  (I seem to be getting some extra records without the character.   Don't understand why, but is not a problem for what I am doing).

The Replace is working.  Great.   It looks identical to what did not work for me, so I must have made a synyax typo.   Who knows, who cares?

PROBLEM SOLVED.

Thanks again.



  
Back to top
 
IP Logged