I think it's a matter of parenthesis.  Take the parenthesis off the end of your 
statement and put it after the fuel_date like this:

 

 (MIN(fuel_date)) IN fuel_usage_file WHERE equip_code = .vequip_code AND 
fuel_date BETWEEN .vfrom_date AND  .vto_date
 

Karen


-----Original Message-----
From: Javier Valencia <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thu, Nov 21, 2013 4:36 pm
Subject: [RBASE-L] - Functions in reports



I am having a brain freeze.
 
I need to calculate the max and min values from a lookup  table for each record 
in a report.
I defined a variable:
vFirstRdng as DATE
and  define it in the report variable section as:
 
(MIN(fuel_date) IN fuel_usage_file WHERE equip_code = .vequip_code AND 
fuel_date BETWEEN .vfrom_date AND  .vto_date)
 
vequip_code, vfrom_date and vto_date are properly defined and have the correct 
type.
 
I keep getting an error and it will not accept the definition for the variable. 
I have tried variations of parenthesis, replacing the IN with FROM with no luck
 
The following command works correctly at the r> prompt:
 
SELECT MIN(fuel_date) IN fuel_usage_file WHERE equip_code = .vequip_code AND 
fuel_date BETWEEN .vfrom_date AND .vto_date
 
And so does this command:
 
SELECT MIN(fuel_date) INTO vFirstRdng FROM fuel_usage_file WHERE equip_code = 
.vequip_code AND fuel_date BETWEEN .vfrom_date AND .vto_date
 
I don’t use report variables that much anymore but I know I have done this 
before quite a bit before DBcalc was available.
I know I am probably missing something really simple but I can’t seem to figure 
out what it is… 
 

Javier,
 
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137



Reply via email to