ckroon
Posts: 869
|
| Posted: 02/09/2008, 10:00 AM |
|
Hi all.
I have a document page that needs to look at three different date fields, and return with the one that is the largest.
Is there an easier way to do this:
$Component->SetValue( $Container->date1->GetValue());
if ($Container->date2->GetValue() > $Container->date1->GetValue())
$Component->SetValue( $Container->date2->GetValue());
if ($Container->date3->GetValue() > $Container->date1->GetValue())
$Component->SetValue( $Container->date3->GetValue());
etc etc etc... its driving me mad.
There has to be an easier way. It's PHP after all!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
DonB
|
| Posted: 02/09/2008, 10:32 AM |
|
in PHP: max( array($value1, $value1, $value3, ...) )
in MySQL: GREATEST(column1, column2, column3, ...)
--
DonB
"ckroon" <ckroon@forum.codecharge> wrote in message
news:547adea46e84dc@news.codecharge.com...
> Hi all.
> I have a document page that needs to look at three different date fields,
> and
> return with the one that is the largest.
> Is there an easier way to do this:
>
> $Component->SetValue( $Container->date1->GetValue());
>
> if ($Container->date2->GetValue() > $Container->date1->GetValue())
> $Component->SetValue( $Container->date2->GetValue());
>
> if ($Container->date3->GetValue() > $Container->date1->GetValue())
> $Component->SetValue( $Container->date3->GetValue());
>
> etc etc etc... its driving me mad.
>
> There has to be an easier way. It's PHP after all!
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
ckroon
Posts: 869
|
| Posted: 02/09/2008, 2:16 PM |
|
Thanks!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
|