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)

Topic Options
#44182 - 07/15/13 01:56 AM Replace string in design document
.Patrick Offline
OL Toddler

Registered: 02/14/13
Posts: 31
Loc: The Netherlands
Hi all,

I have a string in my pdf document (%date%) is it possible to replace it with the current date when the document is printed. (With presstalk or something)?? Cause I can find any solution.

Note; the design is used with planetpress database.

Thx in advance!

Top
#44188 - 07/15/13 04:10 AM Re: Replace string in design document [Re: .Patrick]
ppuserd Offline
OL Guru

Registered: 07/03/12
Posts: 106
assuming you have a global variable &testStr, and it's contents are 'testing 123 fgiafg %date% hidsfau 4'

show(&origStr) would reveal this:- 'testing 123 fgiafg|%date%|hidsfau 4'


one of the many ways to do this would be

-you can find out where your string starts using pos(); pos('%date%',&testStr) would be 20
-know that the length of %date% is 6, making your end 26
-know how long &origStr is using length()
-know how to split up your string using mid()

define(&replaceStr,string,'')
define(&start,integer,pos('%date%',&orgStr))
define(&end,integer,length(&orgStr))

&replaceStr := mid(&orgStr,1,&start - 1) + 'whatever you want' + mid(&orgStr,26,&end)

crlf()

show(&replaceStr)
crlf()
show(&orgStr)

Top
#44191 - 07/15/13 05:17 AM Re: Replace string in design document [Re: .Patrick]
ppuserd Offline
OL Guru

Registered: 07/03/12
Posts: 106
or maybe you want to approach in this way:-


show(&orgStr)
crlf()



search(&orgStr,'%')

if(pos('date',&orgstr) > 0)
show('whatever you want')
else()
show(&orgStr)
endif()

endsearch()
show(&orgStr)
crlf()


Edited by ppuserd (07/15/13 05:18 AM)

Top