FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Create a array from dbfs
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Create a array from dbfs
Posted: Wed Dec 07, 2016 10:17 AM

I wish create a telephon list ( temporaney array) from two archives dbf but I not Know How make it

Is There is a function to create array from databases or I must create it to hand ?
the field are the same only change the prefix init ( CL or PR)
sample

customer : CLNOMBRE
farmer : PRNOMBRE

When I have the array I wish a alphabetic order from a to z ( with tabs)

I saw something in this forum but I not remember where

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Create a array from dbfs
Posted: Wed Dec 07, 2016 02:41 PM
Maybe:

Code (fw): Select all Collapse
   ASORT(MATRIZ,,,{ |Z,W| Z[1]+Z[2] < W[1]+W[2] }
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Create a array from dbfs
Posted: Wed Dec 07, 2016 02:53 PM
Examples:

Code (fw): Select all Collapse
LOCAL aVetor := { “A”, “D”, “C”, “B” }
LOCAL aArray := { 3, 5, 1, 2, 4 }
 
ASORT(aVetor)                          // Resulta: { “A”, “B”, “C”, “D” }
ASORT(aVetor,,, { |x, y| x > y } )     // Resulta: { “D”, “C”, “B”, “A” }
 
ASORT(aArray)                          // Resulta: { 1, 2, 3, 4, 5 }
ASORT(aArray,,, { |x, y| x > y } )     // Resulta: { 5, 4, 3, 2, 1 }
 
 
Este exemplo ordena o segundo elemento de um array de duas dimensões:
 
LOCAL aIndice := { { “Fipe”, 9.3 }, { “IPC”, 8.7 }, { “DIEESE”, 12.3 } }
 
ASORT(aIndice, , , { | x,y | x[2] > y[2] } )
 
// Com base na ordenação acima, a ordem fica:
// DIEESE     12.3
// Fipe        9.3
// IPC         8.7
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion