OPAL Date var headache 
Author Message
 OPAL Date var headache

   Here is a simple little code I've written as the beginning to a fairly
complex group of queries (querys?).  The problem is that when I run the
method, it gives me an error saying I need to
assign a value to a variable before I can use it.  I've narrowed it down
to where I'm pretty sure
it's the line I've marked with the arrow.  But I just don't know what else
to do with it to make it work.  For the date on the SCAN line I treid
DateA, "DateA", ~DateA , "~DateA".
   It's always a warm feeling  when you've got pages of code to wrie and
you get stuck in the first 10 lines.  
  Here's the code, my thank to anyone for ideas.

Var
  DateA  Date
  Cutoff String
  BASE  TCursor
endVar

method pushbutton(var eventinfo Event)
   BASE.open("C:\\midtox\\frmpcfil\mtd2f.dbf")
   BASE.edit()
   Cutoff = "9/8/94"
   DateA = dateval(Cutoff)

-->SCAN BASE FOR BASE.LAST_TEST = "DateA":
     BASE.LAST_TEST = BASE.DATE_1
    ENDSCAN

    BASE.Close
endmethod
\\\\\//////////     Adam Jones

   \__ ~ /      Occupation: Humble Software Consultant, Tech Services
Network



Sun, 28 Dec 1997 03:00:00 GMT
 OPAL Date var headache

I'm a little confused with your code; But I know what you're trying to
do.
It can be simplified to:

method pushbutton(var eventinfo Event)
   BASE.open("C:\\midtox\\frmpcfil\mtd2f.dbf")
   BASE.edit()

SCAN BASE FOR BASE.LAST_TEST =date("9,8,94"):
 BASE.LAST_TEST = BASE.DATE_1
 ENDSCAN



Mon, 29 Dec 1997 03:00:00 GMT
 OPAL Date var headache

        That code looks fine. If you're using 5.0, open a method window,.
select Properties|compile with debug.

        Save your form and run it again to figure out which line of code
this is happening on. Also- try setting a breakpoint, then inspecting
all the variables that you're using to see which one's aren't assigned.

        Here's a {*filter*} code bug that's taken me hours sometimes to track
down:

method returnproblem() logical
if true=false then return true endif
endmethod

Then in your pushbuton, or whatever:
...
var
l logical
endvar

l=test()
endmethod

If you run this code- it'll tell you unassigned variable. Why?

Because the custom method Test() never returns a value!
true=false will always be false so test() never returns true. So it
passes syntax, but still doesn't return a value and your l=test() line
is expecting a return value!

This sample makes it easy to pick out the problem but when you're
(you've) got code that is several pages and has 10+ return lines,
it's --MUCH- harder to spot.

--
Paradox for Windows Consultant. Member: Borland Paradox Technical Support
            Web Page being relocated- want to provide space?

Borland supplied disclaimer: The services I provide via this message
and all consulting services I may provide are in no way associated with
or sponsored by Borland International or any of its subsidiaries.



Mon, 29 Dec 1997 03:00:00 GMT
 OPAL Date var headache
:    Here is a simple little code I've written as the beginning to a fairly
: complex group of queries (querys?).  The problem is that when I run the
: method, it gives me an error saying I need to
: assign a value to a variable before I can use it.

: Var
:   DateA  Date
:   Cutoff String
:   BASE  TCursor
: endVar

: method pushbutton(var eventinfo Event)
:    BASE.open("C:\\midtox\\frmpcfil\mtd2f.dbf")
:    BASE.edit()
:    Cutoff = "9/8/94"
:    DateA = dateval(Cutoff)
:    
Place code or breakpoint here to verify that DateA is assigned a value

    msgInfo("", DateA)

: -->SCAN BASE FOR BASE.LAST_TEST = "DateA":

Have you tried

     Scan Base for base."Last Test" = DateA:

:      BASE.LAST_TEST = BASE.DATE_1

I think this is a problem. it problably should be

      BASE."Last Test" = BASE."Date 1"

unless you actually use underscores in your field names

:     ENDSCAN

:     BASE.Close

Try   BASE.close()

: endmethod

Robert Clemenzi



Tue, 30 Dec 1997 03:00:00 GMT
 OPAL Date var headache

Quote:
>-->SCAN BASE FOR BASE.LAST_TEST = "DateA":
>     BASE.LAST_TEST = BASE.DATE_1
>    ENDSCAN

Adam,

I know it's been a week since you posted this question and you've
probably got your answer by now, but just in case...

I think if you unquote "DateA" the code will work okay.  Paradox is
taking DateA as a string value since it's quoted.

Hope this helps.

Wes



Sun, 04 Jan 1998 03:00:00 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Dates giving me a real headache!!

2. INSERTing dates into access97, headache

3. select (@var = @var + 1) as Rowid, ...into #tmp...

4. What's the Difference between SET @var = and SELECT @var =

5. update set @var=@var

6. Test for object var or with block var?

7. Object Var or With Var not set

8. Environment Var-->Informix 4GL Var

9. Default Date value in a Global Var

10. Group by date only in datetime var

11. Watch Your Date Var Format !!!

12. VAR = Unix date output


 
Powered by phpBB® Forum Software