Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Program is running slow - need advice for optimizing
Message
De
08/07/2004 05:09:11
 
 
À
08/07/2004 04:43:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00921850
Message ID:
00921883
Vues:
22
Mohammed. Note that Tore's code will fail for a table with uneven number of
records, or if the table has no records. Also, the code will skip the third
record because of a double skip command. You should change it to something
like:
* Open source table
SELECT 1
USE ss

* Process all records until EOF
GO TOP
DO WHILE .NOT. EOF()

  * Get 1st record
  m.a=name
  m.a1=p_o_box
  m.a2=Postal_cod
  m.a3=degree
  SKIP

  * Check for 2nd record
  IF .NOT. EOF()

    * Get 2nd record
    m.aa=name
    m.aa1=p_o_box
    m.aa2=postal_cod
    m.aa3=degree
    SKIP

  ELSE

    * Setup blank 2nd record
    m.aa=""
    m.aa1=""
    m.aa2=""
    m.aa3=""

  ENDIF

  * Insert record into NEWALL
  INSERT INTO ;
  NEWALL (name, ;
          p_o_box, ;
          postalcod, ;
          degree, ;
          name1, ;
          p_o_box1, ;
          postalcod1, ;
          degree1, ;
          name2, ;
          p_o_box2, ;
          postalcod2, ;
          degree2) ;
  VALUES (m.a, m.a1, ;
          m.a2, ;
          m.a3, ;
          m.aa, ;
          m.aa1, ;
          m.aa2, ;
          m.aa3, ;
          ss.name, ;
          ss.p_o_box, ;
          ss.postal_cod, ;
          ss.degree )

  * Select source table
  SELECT ss
  
ENDDO
>hello,
>
>thank you very much,
>
>it works with 10 second maximam.
>
>thanks again.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform