Page tree

Should you require any more information or have encountered a problem, please call the support helpdesk on (07) 5456 6000.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

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


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.The package presents as a sequence of rows. Here is a screen shot of the simple structure of tis example:


This is the import screen:




Here is the code running:


 


The Suburb and the State can be captured from the UI of an archetype which runs this code in the onCalculate field for a Postcode Element:


Here is the modified code that does this:






  • No labels