Calculation = Series of tests

Hi

I wrote this calculation for Overdue as a number (and it actually
worked first time)

If ( IsEmpty ( Date_Shipped ); " " ; Get ( CurrentDate ) - Date_Due )

But ideally there is another variable in this calculation - the status
(ordered, invoiced, paid, cancelled).

If the status = "paid" I do not need an Overdue result.

So I wrote this:

Case ( IsEmpty ( Date_Shipped ); " " ; ValueCount ( "3 Paid" ) ; " " ;
Get ( CurrentDate ) - Date_Due )

but it did not work.

What would you recommend?

Thanks
buck.matthew74 [ Di, 08 Januar 2008 05:05 ] [ ID #1902640 ]

Re: Calculation = Series of tests

In article
<943cbbd0-a5d4-4a49-b04b-ead8f0e644aa [at] r60g2000hsc.googlegroups.com>,
buck.matthew74 [at] yahoo.com wrote:

> Hi
>
> I wrote this calculation for Overdue as a number (and it actually
> worked first time)
>
> If ( IsEmpty ( Date_Shipped ); " " ; Get ( CurrentDate ) - Date_Due )
>
> But ideally there is another variable in this calculation - the status
> (ordered, invoiced, paid, cancelled).
>
> If the status = "paid" I do not need an Overdue result.
>
> So I wrote this:
>
> Case ( IsEmpty ( Date_Shipped ); " " ; ValueCount ( "3 Paid" ) ; " " ;
> Get ( CurrentDate ) - Date_Due )
>
> but it did not work.
>
> What would you recommend?
>
> Thanks

I'm not sure there's enough details here, but your second test looks
dodgey.

I'm not sure what the ValueCount function does, but there appears to be
no field(s) involved in that test. Shouldn't it simply be something
like:

Case (IsEmpty(Date_Shipped); " ";
Status = "Paid"; " ";
Get(CurrentDate) - Date_Due
)

You probably also need to add a third test for "Cancelled" orders.


As an aside, do you want the calculation to return a space if either of
the first two tests succeeds?? You can just use "" with no space
between to leave the field completely empty.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
Helpful Harry [ Di, 08 Januar 2008 06:18 ] [ ID #1902641 ]

Re: Calculation = Series of tests

On Jan 7, 9:18=A0pm, Helpful Harry <helpful_ha... [at] nom.de.plume.com>
wrote:
> In article
> <943cbbd0-a5d4-4a49-b04b-ead8f0e64... [at] r60g2000hsc.googlegroups.com>,
>
>
>
> buck.matthe... [at] yahoo.com wrote:
> > Hi
>
> > I wrote this calculation for Overdue as a number (and it actually
> > worked first time)
>
> > If ( IsEmpty ( Date_Shipped ); " " ; Get ( CurrentDate ) - Date_Due )
>
> > But ideally there is another variable in this calculation - the status
> > (ordered, invoiced, paid, cancelled).
>
> > If the status =3D "paid" I do not need an Overdue result.
>
> > So I wrote this:
>
> > Case ( IsEmpty ( Date_Shipped ); " " ; ValueCount ( "3 Paid" ) ; " " ;
> > Get ( CurrentDate ) - Date_Due )
>
> > but it did not work.
>
> > What would you recommend?
>
> > Thanks
>
> I'm not sure there's enough details here, but your second test looks
> dodgey.
>
> I'm not sure what the ValueCount function does, but there appears to be
> no field(s) involved in that test. Shouldn't it simply be something
> like:
>
> =A0 =A0 =A0Case (IsEmpty(Date_Shipped); " ";
> =A0 =A0 =A0 =A0 =A0 =A0Status =3D "Paid"; " ";
> =A0 =A0 =A0 =A0 =A0 =A0Get(CurrentDate) - Date_Due
> =A0 =A0 =A0 =A0 =A0 )
>
> You probably also need to add a third test for "Cancelled" orders.
>
> As an aside, do you want the calculation to return a space if either of
> the first two tests succeeds?? You can just use "" with no space
> between to leave the field completely empty.
>
> Helpful Harry =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
> Hopefully helping harassed humans happily handle handiwork hardships =A0;o=
)

Thank you Harry
That works well. I understand better now the syntax of Case statements.
buck.matthew74 [ Di, 08 Januar 2008 09:46 ] [ ID #1902643 ]
Datenbanken » comp.databases.filemaker » Calculation = Series of tests

Vorheriges Thema: Text field case sensitive? FM pro 8
Nächstes Thema: "Database is damaged and has been closed."