IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Page 1 of 2 1 2 >
Topic Options
#47674 - 04/29/14 11:09 AM Removing text
Bill D Offline
OL Newbie

Registered: 04/29/14
Posts: 16
Hi, I know for many of the posters here this will be a super newb kind of question; I have been teaching myself this new program since my company got a few months ago, but I am not a programmer so PressTalk is just not something I can't wrap head around(never did Pascal before.) So basically I have a Data selection that is pulled from 15 columns on 33 lines. Some of the lines will contain text such as -UC or a suffix of COM that I don't want to print on the form. So how would I set up a Presstalk to look for these multiple conditions when they may start at any Column in that selection and what is then hide/trim them off? TY
~Bill

Top
#47676 - 04/29/14 12:03 PM Re: Removing text [Re: Bill D]
Walli Offline
OL Expert

Registered: 02/13/13
Posts: 320
Loc: Ontario
Hi Bill,
IF you want to replace a character with nothing then use below code in the PressTalk Before section


define(&s, string, '')
&s := stringreplace(@(18,1,69),'-UC','')

I hope it helps.

Top
#47677 - 04/29/14 12:35 PM Re: Removing text [Re: Walli]
Bill D Offline
OL Newbie

Registered: 04/29/14
Posts: 16
I have updated the values to:

define(&s, string, '')
&s := stringreplace(@(&current.line,2,16),'-UC','')

But nothing, even if I change the selection to the exact start location on -UC, I assume I am doing something simple wrong, I did put in in the Talk Before section and it doesn't give me an error. TY
~B

Top
#47680 - 04/29/14 05:01 PM Re: Removing text [Re: Bill D]
Walli Offline
OL Expert

Registered: 02/13/13
Posts: 320
Loc: Ontario
try this
Bill,
If that didn't work try stringreplace.

In the custom data selection, in the string to display box type

=stringreplace(@(18, 1, 50), '-UC', '')

let me know if this works. This worked for me I hope it helps you.

Or someone else may help.

Top
#47681 - 04/29/14 05:03 PM Re: Removing text [Re: Bill D]
Benoit Potvin
Unregistered


Hi Bill,

Is your goal to hide those lines containing the text '-UC' or 'COM' anywhere on the line? Or do you want to still display those lines, but to remove all occurences of '-UC' and 'COM'?

Top
#47692 - 04/30/14 09:11 AM Re: Removing text [Re: Bill D]
Bill D Offline
OL Newbie

Registered: 04/29/14
Posts: 16
@Walli- The custom selection appears to work but that would make me enter for each line, correct? And how would I deal with a 2nd phrase to remove?

@Benoit For this particular instance I am looking to keep all the data on line except for the "-UC" and "COM" Knowing what the code to hide a line would be helpful though too in another part of doc.

Your help is appreciated.
~B

Top
#47699 - 04/30/14 02:15 PM Re: Removing text [Re: Bill D]
Walli Offline
OL Expert

Registered: 02/13/13
Posts: 320
Loc: Ontario
Bill, your next and easy option is to use "Advanced Search and replaced" plug in from the workflow actions. you could have multiple search and replace and select "Search whole file" option to search for "-UC" and "COM" in the entire file and replace it with blank.

I hope this helps

Top
#47704 - 05/01/14 12:05 PM Re: Removing text [Re: Bill D]
Bill D Offline
OL Newbie

Registered: 04/29/14
Posts: 16
Very helpful, I have added that and it works, but I do need to make sure I can restrict within a certain area between lines and columns as that could be a value else where in the document and U wouldn't want to lost it there. How would I do that? TY

Top
#47710 - 05/02/14 11:17 AM Re: Removing text [Re: Bill D]
Benoit Potvin
Unregistered


Bill,

What Walli explained is the right thing to do. To remove the 2nd phrase, you have to nest the 2 stringreplace functions together:

1. Open your data selection and go to the 'repeat' section
2. Choose Line repeat
3. In the From Line - To line, use the data selector or specify the from and to line (e.g. 21 to 35)
4. Click on the 'Data' section. You should see From line =&current.line and To line =&current.line
5. Click on 'Custom data selection'
6. In the string to display, write your data selection for a single line, using &current.line as the line number, and nest this data selection within 2 stringreplace calls:

Code:
=stringreplace(stringreplace(@(&current.line,1,80), '-UC',''),'COM','')


7. Set CRLF to False

Explanation of the PlanetPress Talk expression:
A. =@(&current.line,1,80) displays the current line, from column 1 to 80. &current.line is specified in the line repeat

B. =stringreplace(@(&current.line,1,80), '-UC','') removes all occurences of '-UC' from the selection made in A.

C. =stringreplace(stringreplace(@(&current.line,1,80), '-UC',''),'COM','') removes all occurences of 'COM' from the string produced in B.


Hope this helps!

Ben

Top
#47713 - 05/02/14 12:25 PM Re: Removing text [Re: Bill D]
Walli Offline
OL Expert

Registered: 02/13/13
Posts: 320
Loc: Ontario
Hi Benoit,
Thanks for completing this call. I have also learned a new curve.
MERCI

Top
Page 1 of 2 1 2 >