GuidoApp check_db "CHECK DATABASE CONNECTED"
$check_db setParam "databasesession" "GeologyDatabase"
set result [$check_db invoke]
$check_db destroy
if {$result == "0"} {
GuidoScript scripts/geologyutilities.tcl
GuidoForm form {
-default_buttons
-label "Write Composites to Database"
-tip DB_COMP_WRITE_TIP
-layout BoxLayout Y_AXIS
GuidoPanel p1 {
-layout CentreLineLayout
GuidoDatabaseTableBrowser composite_table {
-display_length 10
-label "Composite table"
-max_length 18
-database dbHandle
-table_types "interval"
-null false
-exclusive true
-tip DB_READ_COMPOSITES_TABLE_TIP
-default ""
-action focusGained {[
populateFieldBrowser $composite_field $composite_table "optional" "character"
if {[$composite_field getCurrentValue] == [$composite_field getItemAt 0]} {
$composite_field setCurrentValue [$composite_field getItemAt 0]
}
]}
}
GuidoTableFieldBrowser composite_field {
-display_length 10
-format none
-label "Composite field"
-max_length 18
-database dbHandle
-exclusive true
-translate none
-action focusGained {[
populateFieldBrowser $composite_field $composite_table "optional" "character"
if {[$composite_field getCurrentValue] == [$composite_field getItemAt 0]} {
$composite_field setCurrentValue [$composite_field getItemAt 0]
}
]}
-validation {[validateTableFieldPair $composite_table $composite_field]}
-tip DB_READ_COMPOSITES_FIELD_TIP
-null false
-field_types optional
}
}
GuidoButtonGroupPanel write_method {
-layout BoxLayout Y_AXIS
-legacy_action
-border etched true
-label "Composite Recording Method"
GuidoRadioButton b1 {
-caption "Append on screen data to database (pre-v5.1 method)"
-selected_value append_comp
-tip DB_WRITE_COMPOSITES_APPEND_TIP
}
GuidoRadioButton b2 {
-caption "Clear existing composites in displayed holes from database"
-selected_value clear_hole_comp
-tip DB_WRITE_COMPOSITES_CLEAR_HOLES_TIP
}
GuidoRadioButton b3 {
-caption "Flush all composites from database"
-selected_value flush_comp
-tip DB_WRITE_COMPOSITES_CLEAR_DATABASE_TIP
}
GuidoRadioButton b4 {
-caption "Invalidate all composites in displayed holes from database"
-selected_value invalidate_comp
-tip DB_WRITE_COMPOSITES_INVALIDATE_COMP_TIP
}
}
}
GuidoApp get_handle "GET DATABASE HANDLE"
$get_handle setParam sessionType "GeologyDatabase"
set status [$get_handle invoke]
set dbHandle [$get_handle getParam DatabaseHandle]
$get_handle destroy
$composite_table updateBrowserList
set databuf [ GuidoExecServer GetComposites {} ]
set status [GuidoGetParamBufferValue $databuf status]
if {$status >= 0} {
$composite_table setCurrentValue [GuidoGetParamBufferValue $databuf "composite_table"]
$composite_field setCurrentValue [GuidoGetParamBufferValue $databuf "composite_field"]
}
set return_code -1
while { $return_code != "0" } {
set return_code [$form interact]
if {$return_code == "apply"} {
set table [$composite_table getCurrentValue]
set field [$composite_field getCurrentValue]
set buffer [GuidoExecServer ValidTableFieldPair [subst {TableName = $table FieldName = $field}]]
if {[ GuidoGetParamBufferValue $buffer status ] >= 0} {
GuidoApp writecomposite "WRITE COMPOSITES"
$writecomposite setParam table [$composite_table getCurrentValue]
$writecomposite setParam field [$composite_field getCurrentValue]
$writecomposite setParam db_set_method [$write_method getCurrentValue]
set return_code [$writecomposite invoke]
$writecomposite destroy
} else {
GuidoMessage warning DB_NO_SUCH_FIELD_ERR $field $table
}
} else {
break;
}
}
$form destroy
}
