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
#41592 - 12/03/12 04:03 PM Post a Future Date on a Document Trouble
Wildcard Offline
OL Newbie

Registered: 08/30/12
Posts: 25
I am new to Planet Press and I am having an issue getting a future date that is three days in adance of the date the document is printed.

First I downloaded the PP Talk Date Library from the website and went to Global Function Libarary Manager and pointed to the directory of this download. I see all the new functions but I thought this would be added to this Talk Editor menu?

Either way, I added the AddDaysToDate Function and this is where I am currently stuck. I do know know what is needed from here to get a simple date that is a few days out on my screen.

What I assume is I need a planet press talk object and it somehow has to reference this function.

The function is as follows.

function @AddDaysToDate(&Date:Date,&DateFormat:MMDDYYYY,&DaysToAdd:): string
%-----------------------------------------------------------
% Function that adds a number of days to a given date. -
%-----------------------------------------------------------
% Input: &Date Date. -
% &DateFormat Format of the date. Use -
% "DD" for day, "MM" for month and -
% "YY" or "YYYY" for year. -
% &DaysToAdd Number of days to add (use -X to -
% substract days). -
% Output: Calculdated date. -
% Uses: NormalizeDate(), DaysInMonth(), FormatShortDate()-
%-----------------------------------------------------------
% Written by: Marty Jacques, Objectif Lune -
% Last updated: February 9, 2005 -
%-----------------------------------------------------------
define(&sResult,string,'')
&Date:=@NormalizeDate(&Date,&DateFormat)
if(mid(&Date,1,1)<>'*')
define(&Day,integer,StrToInt(mid(&Date,1,2)))
define(&Month,integer,StrToInt(mid(&Date,3,2)))
define(&Year,integer,StrToInt(mid(&Date,5,4)))
define(&MonthDays,integer,@DaysInMonth(&Month,&Year))
define(&DayCount,integer,0)
if(&DaysToAdd>0)
repeat
&DayCount:=&DayCount+1
&Day:=&Day+1
if(&Day>&MonthDays)
&Month:=&Month+1
&Day:=1
if(&Month>12)
&Year:=&Year+1
&Month:=1
endif
&MonthDays:=@DaysInMonth(&Month,&Year)
endif
until(&DayCount=&DaysToAdd)
endif
if(&DaysToAdd<0)
repeat
&DayCount:=&DayCount+1
&Day:=&Day-1
if(&Day<1)
&Month:=&Month-1
if(&Month<1)
&Year:=&Year-1
&Month:=12
endif
&MonthDays:=@DaysInMonth(&Month,&Year)
&Day:=&MonthDays
endif
until(neg(&DayCount)=&DaysToAdd)
endif
&sResult:=right('00'+IntToStr(&Day),2)
&sResult:=&sResult+right('00'+IntToStr(&Month),2)
&sResult:=&sResult+IntToStr(&Year)
&sResult:=@FormatShortDate(&sResult,'DDMMYYYY',&DateFormat)
elseif
&sResult:=&Date
endif
&result:=&sResult
endfunction()

Top
#41594 - 12/03/12 04:41 PM Re: Post a Future Date on a Document Trouble [Re: Wildcard]
Wildcard Offline
OL Newbie

Registered: 08/30/12
Posts: 25
Also wanted to point out that I have the other functions it list added to my global functions for this document.

Top
#41595 - 12/03/12 05:15 PM Re: Post a Future Date on a Document Trouble [Re: Wildcard]
JFLAIR
Unregistered


Wildcard,

Simply take a data selection and choose "Custom data selection". In it you will write:
Code:
=@AddDaysToDate(Todays's date(in string format with the// as seperator),Date Format depending of your regional settings don't forget the // in the date format 'MM/DD/YYYY', the number of days you want to add(integer)


Let me know if this helps.
Don't forget to put the functions in order.

Regards,
JF

Top