Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

GELLO can query a database. This example will show some some code that autocompletes queries a database for a postcode based on the a given locality. This page will then show it in use in an archteypearchetype.


Here is some code for this:


imports DB_Postcodes
Let retrievedSuburbName: String = 'Bray Park' -- this will be the entered Suburb or locality
Let retrievedStateName: String = 'NSW' -- this will be the entered State
Let postcodeTable: Sequence(TBL_csv)= csv
Let selectedRowOrRows: Sequence(TBL_csv) = postcodeTable->select((Suburb_locality = retrievedSuburbName)
and (State = retrievedStateName))
Let postcodeAsInteger: Integer = selectedRowOrRows.Postcode ->flatten()->last()
Let result: Real = postcodeAsInteger.oclAsType(Real)
result.toChar()


DB_Postocdes in this case is a csv file. The MO Gello Authoring tool will also load SQL Lite file and Firebird files.