Alpha Video Training
Results 1 to 3 of 3

Thread: Variable type

  1. #1
    BRIAN GRAY
    Guest

    Default Variable type

    Dim testing[11]as P
    testing.initialize_properties("Time|Appt|record",daylist)
    Dim try as N
    try = testing.find("9:00AM ","Time")
    Dim vtime as C
    vtime=testing[try].time

    Quick question with the above code. If "9:00AM" exists vtime is a character variable if it does not exist it coming back as a Pointer which is of course giving an error message. What is the best way of handling this?? If I declare vtime as A everything is fine but not sure if that is wise.
    Thanks for any help
    Brian

  2. #2
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,306

    Default RE: Variable type

    you can't just blindly expect that your 'find' will be successful. if the .find() method does not find a match, then the value that it returns is 0. so you code must be modified:



    Dim testing[11]as P
    testing.initialize_properties("Time|Appt|record",daylist)
    Dim try as N
    try = testing.find("9:00AM ","Time")
    Dim vtime as C
    if try " 0 then
    vtime=testing[try].time
    else
    vtime = ""
    end if

  3. #3
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,306

    Default RE: Variable type

    another thing to remember. .find() is case sensitive. so i typically to this to make it case insensitive


    try = testing.find(ut("9:00AM"),"ut(Time)")

Similar Threads

  1. variable type mismatch
    By Ruth Asfaw in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-20-2005, 08:49 AM
  2. How to change a variable type
    By RobertJWilkins in forum Alpha Five Version 5
    Replies: 2
    Last Post: 07-29-2004, 12:23 PM
  3. Variable type mismatch
    By dchiass in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-02-2004, 04:35 AM
  4. Variable Type
    By James Peterson in forum Alpha Five Version 4
    Replies: 3
    Last Post: 06-06-2002, 10:45 AM
  5. Variable type mismatch
    By Anis in forum Alpha Five Version 4
    Replies: 7
    Last Post: 02-16-2001, 08:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •