Calculation = Series of tests

Calculation = Series of tests

am 08.01.2008 05:05:51 von buck.matthew74

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

Re: Calculation = Series of tests

am 08.01.2008 06:18:00 von Helpful Harry

In article
<943cbbd0-a5d4-4a49-b04b-ead8f0e644aa@r60g2000hsc.googlegroups.com>,
buck.matthew74@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)

Re: Calculation = Series of tests

am 08.01.2008 09:46:11 von buck.matthew74

On Jan 7, 9:18=A0pm, Helpful Harry
wrote:
> In article
> <943cbbd0-a5d4-4a49-b04b-ead8f0e64...@r60g2000hsc.googlegroups.com>,
>
>
>
> buck.matthe...@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.