Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird variable not found error
Message
 
À
15/04/2001 17:23:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00495669
Message ID:
00495684
Vues:
8
Hi Karl,

You're setting a filter using memvar 'mlogday'. Because you didn't declare the variable it defaults to private. You're not closing the tables when the program is done so I'm assuming you're just browsing when the program is finished. Because there is a filter based on a private memvar that has gone out of scope VFP can't resolve the filter, hence the error.

I would suggest using 'select sensorlog' and 'select dailysummary' instead of 'select 1' and 'select 2'. Makes for less fragile code.

That's all that jumps out immediately. Try single stepping with the debugger and pay attention to which work area is the current area.

HTH,
Roger


>I have a simple procedure that is giving me a varible not found error. The variable fox can't find is a field in the currently selected table. Even stranger, the below program runs just fine until the DO loop to increment the days is added. With the DO loop, I get the error "Variable 'Julianday' not found", right after a SET FILTER TO command
>
>However;after running either version of the procedure, if I try to BROW the table, I get a variable not found error with the name of the memory variable as the variable not found. ie "Variable 'mlogday' not found" Somehow, I've confused fox on the name of the field in my table???
>
>I put in a copy of the procedure and table structure below. Can someone tell me what's wrong here?
>
>Karl
>
>
>
>
>CLEAR ALL
>SELECT 1
>USE C:\Hillside\Temperature\SensorLog ORDER julianday
>SELECT 2
>USE c:\Hillside\Temperature\Dailysummary
>*USE c:\Hillside\Temperature\configuration IN 3
>
>SELECT 1
>GO TOP
>mlogday = julianday &&daynumber in sensorlog
>mhour = loghour &&hournumber in sensorlog
>mhournow = HOUR(datetime()) && hour of the present time
>
>
>baseday = "01/01/" + STR(year(date()),4) &&add baseday to daynember in sensorlog to get date
>Newyearsday = {&baseday} &&baseday in date format
>logday = newyearsday + julianday &&day to summarize
>
>
>********Procedure runs if do loop commented out.
>********DO WHILE logday <= date() && summarize for everyday
> mdd32 = 0
> mdd40 = 0
> mdd42 = 0
> mdd50 = 0
> mdd52 = 0
>
>
> DO WHILE mhour < 24 && get avg. temp for a given hour
> SET FILTER TO (loghour = mhour) .AND. (julianday = mlogday)
> CALCULATE AVG(ds1) TO mhourlytemp
> CALCULATE CNT() TO counter
> mhourlytemp = 1.8*mhourlytemp + 32
>
> ***Degree day summation
> IF mhourlytemp > 32
> mdd32 = mdd32 + mhourlytemp - 32
> ENDIF
> IF mhourlytemp > 40
> mdd40 = mdd40 + mhourlytemp - 40
> ENDIF
> IF mhourlytemp > 42
> mdd42 = mdd42 + mhourlytemp - 42
> ENDIF
> IF mhourlytemp > 50
> mdd50 = mdd50 + mhourlytemp - 50
> ENDIF
> IF mhourlytemp > 52
> mdd52 = mdd52 + mhourlytemp - 52
> ENDIF
>
> *** RECORD THE HOUR'S TEMPERATURE
> SELECT 2
> LOCATE FOR logday = summaryday
> IF .NOT. FOUND() && add record if not there
> GO BOTTOM
> APPEND BLANK
> REPLACE summaryday WITH logday
> ENDIF
> IF counter > 0 && only record if you have data
> mrow = "hour" + ALLTRIM(STR(mhour))
> REPLACE &mrow WITH mhourlytemp
> ENDIF
> mhour = mhour +1
> SELECT 1
> ENDDO
>
> ***record daily summary data
>
> SET FILTER TO julianday = mlogday
>
>**!!! Program error: Variable 'julianday' is not found
>
>
> CALCULATE MAX(ds1) TO mmax
> CALCULATE MIN(ds1) TO mmin
> SELECT 2
> REPLACE maximum WITH (1.8*mmax + 32)
> REPLACE minimum WITH (1.8*mmin + 32)
> REPLACE dd32 WITH (mdd32/24)
> REPLACE dd40 WITH (mdd40/24)
> REPLACE dd42 WITH (mdd42/24)
> REPLACE dd50 WITH (mdd50/24)
> REPLACE dd52 WITH (mdd52/24)
>
> logday = logday + 1 &&next day in date format
> mlogday = mlogday + 1 &&next log day number
>******ENDDO &&procedure runs if commnted out
>
>
>
>
>
>
>Structure for table: C:\HILLSIDE\TEMPERATURE\SENSORLOG.DBF
>Number of data records: 1381
>Date of last update: 04/15/01
> Code Page: 1252
> Field Field Name Type Width Dec Index Collate Nulls
> 1 LOGYEAR Numeric 4 Asc Machine No
> 2 JULIANDAY Numeric 3 Asc Machine No
> 3 LOGHOUR Numeric 2 No
> 4 LOGMINUTE Numeric 2 No
> 5 LOGSECOND Numeric 2 No
> 6 DS1 Numeric 5 2 No
> 7 DS2 Numeric 5 2 No
> 8 DS3 Numeric 5 2 No
> 9 DS4 Numeric 5 2 No
>** Total ** 34
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform