Alpha Video Training
Results 1 to 9 of 9

Thread: get data from 2 or more tables or .dbf files

  1. #1
    Member
    Real Name
    Fur-Jiang Leu
    Join Date
    Apr 2009
    Posts
    76

    Default get data from 2 or more tables or .dbf files

    How to make a query that can get data from 2 or more tables or .dbf files?
    Because I have large data files that are separated by the year. Such as data2005.dbf and data2006.dbf.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: get data from 2 or more tables or .dbf files

    Because I have large data files that are separated by the year.
    Inadvisable data/table structure. I suppose you could copy the data from multiple "large data files" to a temporary table, based on some filter, and query the result table.
    There can be only one.

  3. #3
    Member
    Real Name
    Fur-Jiang Leu
    Join Date
    Apr 2009
    Posts
    76

    Default Re: get data from 2 or more tables or .dbf files

    Thanks. But, How can I copy data to ONE temporary table? Because the 1st temporary table are forced to be overwritten by the later copy operation.

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: get data from 2 or more tables or .dbf files

    I didn't mean copy the data literally using a copy operation. Create the temporary table, empty it, and use multiple append operations to populate the temporary table.

    You could also use one copy operation to create the temporary table and subsequent append operations to add to it.
    There can be only one.

  5. #5
    Member
    Real Name
    Fur-Jiang Leu
    Join Date
    Apr 2009
    Posts
    76

    Default Re: get data from 2 or more tables or .dbf files

    Dear stan:
    I tried the method of append operations and it works very good. Thanks a lot.
    And I use For Each ... loop to conserve the code as the following.
    list = <<%a%
    pa
    pa04
    <<%a%
    for each c00 in list

    However, I got problem on 3 runs of the loop (one more than the number of the items). How can I stop on the end of the last run?

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: get data from 2 or more tables or .dbf files

    The syntax for creating the list variable does not use the << in the final line so the << is being interpreted as the third value.

    Code:
    list = <<%a%
    pa
    pa04
    <<%a% '<< is not used here
    for each c00 in list
    Should be

    Code:
    list = <<%a%
    pa
    pa04
    %a%
    for each c00 in list
    This is the script I ran to discover the error......


    Code:
    list = <<%a%
    pa
    pa04
    <<%a%
    for each c00 in list
    ui_msg_box("","list variable is "+c00.value)
    next
    There can be only one.

  7. #7
    Member
    Real Name
    Fur-Jiang Leu
    Join Date
    Apr 2009
    Posts
    76

    Default Re: get data from 2 or more tables or .dbf files

    Thanks a lot. This really solved my problem.
    One more question: Can I assign the list array on a single line or in another format? Such as {pa, pa04} used in Access.

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: get data from 2 or more tables or .dbf files

    Can I assign the list array on a single line or in another format?
    NO clue what you mean.


    Code:
    list = "pa"+crlf()+"pa04"
    This accomplishes the same as your <<% code.

    Code:
    list = comma_to_crlf("pa,pa04")
    This accomplishes the same as your <<% code.

    Alpha has a multitude of list processing functions.
    There can be only one.

  9. #9
    Member
    Real Name
    Fur-Jiang Leu
    Join Date
    Apr 2009
    Posts
    76

    Default Re: get data from 2 or more tables or .dbf files

    Dear Stan:
    Thanks a lot. This is what I am looking for.
    FJ

Similar Threads

  1. dbf files
    By deputy956 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 36
    Last Post: 10-28-2008, 11:13 AM
  2. Lost .dbf Tables
    By Dave Mac Callum in forum Alpha Five Version 7
    Replies: 2
    Last Post: 08-08-2007, 03:10 AM
  3. Inporting DBF files
    By Peter-B in forum Alpha Five Version 7
    Replies: 5
    Last Post: 06-05-2006, 12:47 AM
  4. Encrypting DBF files
    By kumargroup in forum Alpha Five Version 5
    Replies: 1
    Last Post: 10-23-2003, 11:02 AM
  5. DBF or ADB files
    By Jean-P. B├ędard in forum Alpha Five Version 4
    Replies: 2
    Last Post: 06-04-2000, 02:16 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
  •