[DUG] Count

Dave O'Brien dave at ICCS.CO.NZ
Thu Jan 24 13:37:32 NZDT 2008


The semicolon after the then is probably causing a problem...

if x = 0 then if y = 1 then ; <---
  CurrDeviceSelection :=  CurrOptionList.items[0];

Or you could try embedded case statements:

Case x of
  0: Case y of
       1: CurrDeviceSelection := CurrOptionList.items[0] ;
       2: CurrDeviceSelection := CurrOptionList.items[1] ;
     End ;
  1: Case y of
       1: CurrDeviceSelection := CurrOptionList.items[2] ;
       2: CurrDeviceSelection := CurrOptionList.items[3] ;
     End ;
End ;

Or, if the selection is always from CurrOptionList.items, and x and y
are a static set, multiply x by the maximum number of y's and add y to
reference directly into CurrOptionList.items.


-----Original Message-----
From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Bob Pawley
Sent: Thursday, 24 January 2008 1:16 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Count

Hi

I have two variables x and y that are sums of column rows.

I am attempting to drive a command depending on the number returned be
each 
variable. For instance:

    if x = 0 then if y = 1 then ;
     CurrDeviceSelection :=  CurrOptionList.items[0];

Delphi doesn't like a " if x=0 and y=0 then" at deign time but it also 
doesn't like the above any better at run time.

Is there a better expression that I can use to compare two variables???

Bob 

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
Subject: unsubscribe



More information about the Delphi mailing list