GetAllFields |
Databases | |
Aptilis 1 |
GetAllFields(DestArray[], Record)
GetAllFields loads all the fields of a record straight into an array. This saves you from having to do it for each field individually.
Return value:
The number of fields found. That can be zero.
Example:
We are going to load the following database, called 'db.txt':
"Mouse","mammal","cheese" "Horse","mammal","Hay, grass" "Fish","vertebrate","alguae, other fish, plancton" "Snail","invertebrate","lettuce" "Termite","insect","your house" "Man","mammal","meat, vegetables, fruits" "Leelou","furry thing","cat food in cans"Now the code:
n = loadDatabase(db[], "db.txt") for i=0 to n-1 getAllFields(fields[], db[i]$) print("Name: ", fields[0]$, "\n") print("Type: ", fields[1]$, "\n") print("Feeds on: ", fields[2]$, "\n") print("++++++\n") end forResult:
Name: Mouse Type: mammal Feeds on: cheese ++++++ Name: Horse Type: mammal Feeds on: Hay, grass ++++++ Name: Fish Type: vertebrate Feeds on: alguae, other fish, plancton ++++++ Name: Snail Type: invertebrate Feeds on: lettuce ++++++ Name: Termite Type: insect Feeds on: your house ++++++ Name: Man Type: mammal Feeds on: meat, vegetables, fruits ++++++ Name: Leelou Type: furry thing Feeds on: cat food in cans ++++++ |
(I apologize to the biologist community for my approximative knowledge of living things. Leelou is my lovely kitty.)
See also:
loadDatabase,
getField.
Database speak: