Customise a query
Sample Tracker uses a predefined SQL statement to retrieve available samples from the database table GB_SAMPLE or (if your system is configured to handle fractions) GB_SAMPLE_FRACTION.
To execute a query to retrieve the samples that will be considered for inclusion in the despatch, select the Use a customised query option. The records returned as a result of the query will be used to initialise the list of samples.
The first time you select the Use a customised query option, a default SQL query is provided which you can then customise or use "as is". The default query does not include previously despatched samples.
In some situations you may choose to override this default behaviour. For example, when:
- Your sample database structure does not fit the Standard Sample Tracker model
- You wish to include additional selection criteria or substitution parameters
- You wish to read the sample list from a table already containing all the appropriate samples, checks and standards for the despatch
If you do not select the Use a customised query option, no records will be displayed when you navigate to the Samples page. You will then need to manually select the samples to be included in the despatch.
Use the tools provided on the Sample Despatch toolbar to load, add, or remove samples listed in the Samples page. See: Samples List Tools
Here is an example of a customised query using a substitution parameter:
As with all Micromine Geobank process queries, the customised query must return a number of required columns. Use column aliases where necessary in order to ensure that your column names match those displayed in the list to the right of the SQL pane. Columns shown in bold must return a valid, non-blank value.
The query should only return routine, check and standard samples. These are identified by using the codes ROUTINE, CHECK and STANDARD respectively in the QC_TYPE column.
If your data contains codes for other QC Types, you should either decode the values in the SQL query to return the correct codes, or alternatively change the codes defined as part of your Database Options (on the Advanced tab of the Database Connection Property Editor).