CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Compare three date fields and return largest

Print topic Send  topic

Author Message
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.
View profile  Send private message
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.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.