# ------------------------------------------------------------ # Copyright (c) 2023-2023 # Q.W.Page Associates Inc. # www.qwpage.com # All rights reserved. # ------------------------------------------------------------ # ------------------------------------------------------------ # Active index notes # ------------------------------------------------------------ /* { - defaulted fields - active_index todo list - enable active_index for window databases - interactive indexes need special attention - collection_is_enabled? needs a review - account history check can only check against active indexes. - grep - cpp_record_count - cpp_record_read - cpp_record_next - cpp_record_prev - cpp_file_open - cpp_file_record_count - cpp_file_record_read - cpp_file_record_next - cpp_file_record_prev Discussion Should id index always be enabled, including when the collection is disabled? I came down on the side of not making id index it active under a disabled collection. Then the id index was gathered up from id indexes below when it's collection was made enabled. Then, when the collection is disabled, do we delete the id index? */ } ::namespace eval ::qw::odb::active_index {} ::proc ::qw::odb::active_index::key_build {sargs} { /* { Usage: ::set Key [::qw::odb::active_index::key_build \ .database $Database \ .reference $Reference \ # Reference address .ifs_file_path \ # needed to get the index's class_path. ]; We could build the keys using the object manager and existing odb object methods. However, using the odb objects is somewhat overkill because we have to generate the records, including keys and amounts. The key_build method is specialized to generate records copied from existing records in primary (.index/id) index. We are just copying those records. We can re-use the amounts as given in the source records. The keys are the only thing that must be generated. We don't have to worry about closures, but we do have to determine is_hit but doing so at low level means we don't have to load odb objects. This is much faster and much more memory-efficient. Note: We have the index address so we could load the index OS and get the index class_path from the OS. But supplying the ifs_file_path and extracting the index class_path from it avoid the need to load the index OS for each record. We already have to load the reference OS. ::qw::odb::active_index::key_build does not handle interactive indexes, .collection.index or .collection.index/id. - interactive index keys are just odometers which are generated as the index is copied from the primary - .index is always active but never a hit so is never generated - .index/id is always active unless collection disabled - it never has an entry in an active_index_structure - we always know what it's key is */ } ::set IsTest [::sargs::boolean_get $sargs .is_test]; ::if {$IsTest} { ::puts "rwb_debug,key_build,is_test,1000.0,sargs==$sargs"; ::set IndexPath [::string map [::list "/odb/index" ""] [::sargs::get $sargs .ifs_file_path]]; } ::if {!$IsTest} { ::if {!$::qw::control(active_index_is_enabled)} { ::qw::bug 314120231123160731 "[::qw::procname] - invalid active_index_is_enabled."; } ::set Database [::sargs::get $sargs .database]; ::set Reference [::sargs::get $sargs .reference]; ::set IfsFilePath [::sargs::get $sargs .ifs_file_path]; # ::puts "rwb_debug,key_build,4444.0,IfsFilePath==$IfsFilePath" ::set OS [$Database cpp_object_structure_load .address $Reference]; ::sargs::var::set sargs .object_structure $OS; # needed by some calls to ::qw::odb procs ::set Data [::sargs::get $OS .data]; ::set IndexPath [::string map [::list "/odb/index" ""] $IfsFilePath]; ::set ClassPath [::string range $IndexPath 0 [::expr {[::string first "." $IndexPath]-1}]]; } ::switch -glob -- $IndexPath { /OBJECT* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/AUDIT* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/AUDIT*.odb_deriveds.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .date] \ ]; } /OBJECT/SYSTEM/AUDIT*.odb_deriveds.index/path { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .path] \ ]; } /OBJECT/SYSTEM/AUDIT*.odb_deriveds.index/operation { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .operation] \ ]; } /OBJECT/SYSTEM/AUDIT*.odb_deriveds.index/address { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .address] \ ]; } } } /OBJECT/SYSTEM/USER* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/USER*.access_tos.index/object_ref_name* { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::set Reference [::sargs::get $Data .object]; ::if {$Reference eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/SYSTEM/USER*.access_tos.index/object_ref_description* { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::set Reference [::sargs::get $Data .object]; ::if {$Reference eq ""} { ::return [::list string "" string ""]; } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/SYSTEM/USER*.access_tos.index/object_ref_description* { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::set Reference [::sargs::get $Data .object]; ::if {$Reference eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list string [::sargs::get $Data .description] string [::sargs::get $Data .name]]; } /OBJECT/SYSTEM/USER.sessions.index/user_ref_name* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/user_ref_name"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::set Reference [::sargs::get $Data .user]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::sargs::get $OS .data.name] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/login_date* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/login_date"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/logout_date* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/logout_date"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ date [::sargs::get $Data .logout_date] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/state* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/state"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .state] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/hostname* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/hostname"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .hostname] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/serial* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/serial"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .serial] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/nic* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/nic"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .nic] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.sessions.index/ip* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/ip"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .ip] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/USER*.audit_trail.index/date { ::if {$IsTest} {::return;} ::return [::list date [::sargs::get $Data .date]]; } /OBJECT/SYSTEM/USER*.audit_trail.index/path { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .path]]; } /OBJECT/SYSTEM/USER*.audit_trail.index/address { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .address]]; } /OBJECT/SYSTEM/USER*.audit_trail.index/operation { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .operation]]; } } } /OBJECT/SYSTEM/SESSION* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/SESSION.odb_deriveds.index/user_ref_name* { ::if {$IsTest} {::return;} ::set Reference [::sargs::get $Data .user]; ::if {$Reference eq ""} { ::return ""; } ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/user_ref_name"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::sargs::get $OS .data.name] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/state* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/state"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .state] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/login_date* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/login_date"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/logout_date* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/logout_date"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ date [::sargs::get $Data .logout_date] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/hostname* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/hostname"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .hostname] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/serial* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/serial"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .serial] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/nic* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/nic"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .nic] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.odb_deriveds.index/ip* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::if {$Id ne "/ip"} { ::if {"/[::sargs::get $Data .state]" ne $Id} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .ip] \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SYSTEM/SESSION.audit_trail.index/date { ::if {$IsTest} {::return;} ::return [::list date [::sargs::get $Data .date]]; } /OBJECT/SYSTEM/SESSION.audit_trail.index/path { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .path]]; } /OBJECT/SYSTEM/SESSION.audit_trail.index/address { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .address]]; } /OBJECT/SYSTEM/SESSION.audit_trail.index/operation { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .operation]]; } } } /OBJECT/SYSTEM/ACCESS* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/ACCESS*.odb_deriveds.index/object { ::if {$IsTest} {::return;} ::set Object [::sargs::get $Data .object]; ::if {$Object eq ""} { ::return [::list string ""]; } ::set Collection [::sargs::get $Data .object]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::set Result [::list string [::sargs::get $OS .system.object_id]]; ::return $Result; } } } /OBJECT/SYSTEM/WINDOW* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/WINDOW/SCREEN* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/WINDOW/SCREEN.odb_deriveds.index/database { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .database_id] \ string [::sargs::get $Data .user] \ ]; } } } } } } } /OBJECT/NEWVIEWS* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK*.timecards.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK*.timecards.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK*.timecards.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } } } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION*.odb_deriveds.index/debit_account { ::if {$IsTest} {::return;} ::set Collection [::qw::odb::transaction_default_field_odb_get $sargs .field_path .posting/debit.account]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .system.id] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION*.odb_deriveds.index/credit_account { ::if {$IsTest} {::return;} ::set Collection [::qw::odb::transaction_default_field_odb_get $sargs .field_path .posting/credit.account]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .system.id] \ ]; } } } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.paychecks.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.paychecks.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.paychecks.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.timecards.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.timecards.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.timecards.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN*.timecards.index/paycheck_ref_reference { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .paycheck]; ::if {$Collection eq ""} { ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $OS .data.reference] \ ]; } } } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE/CANADA* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE/CANADA.roes.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .date] \ ]; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.odb_deriveds.index/description { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::set ObjectId [::sargs::get $OS .system.object_id]; ::set Name [::sargs::get $Data .name]; ::set Description [::sargs::get $Data .description]; ::if {$Description ne ""} { ::set Result [::list \ string $Description \ string $Name \ ]; ::return $Result; } ::set Description [::sargs::get $Data .employee_name.print_as]; ::if {$Description ne ""} { ::set Result [::list \ string $Description \ string $Name \ ]; ::return $Result; } ::set Description [::qw::odb::employee_name_formatted .format $::qw::name::formats(printable) .object_structure $OS]; ::if {$Description ne ""} { ::set Result [::list \ string $Description \ string $Name \ ]; ::return $Result; } ::return [::list \ string "" \ string $Name \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.odb_deriveds.index/employee_id { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .employee_id] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.accounts.index/name { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.accounts.index/description { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.paychecks.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.paychecks.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.paychecks.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.timecards.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.timecards.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.timecards.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE*.timecards.index/paycheck_ref_reference { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .paycheck]; ::if {$Collection eq ""} { ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $OS .data.reference] \ ]; } } } } } /OBJECT/NEWVIEWS/ACCOUNT* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/AR* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/support_plan_contract_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .support_plan_contract_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/serial_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .serial_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/address_inner_phone_inner_freeform { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::account_address_form_freeform_odb_get $sargs] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/company { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .address.company] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/address_inner_zipcode { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .address.zipcode] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/payroll_plan_end_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .payroll_plan_end_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/support_plan_end_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .support_plan_end_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/nv2_support_plan_end_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .nv2_support_plan_end_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/nv2_upgrades_plan_end_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .nv2_upgrades_plan_end_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/name_closure/posting_active { ::if {$IsTest} {::return;} ::if {![::qw::odb::odb_account_is_active_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/description_closure/posting_active { ::if {$IsTest} {::return;} ::if {![::qw::odb::odb_account_is_active_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/posting_active { ::if {$IsTest} {::return;} ::if {![::qw::odb::odb_account_is_active_posting_account $sargs]} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/report_ref_odb_path_help_closure/posting_active { ::if {$IsTest} {::return;} ::if {![::qw::odb::odb_account_is_active_posting_account $sargs]} { ::return ""; } ::set Collection [::sargs::get $Data .report]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.odb_deriveds.index/odb_path_backward/posting_active { ::if {$IsTest} {::return;} ::if {![::qw::odb::odb_account_is_active_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::qw::odb::odb_path_backward_readable $sargs] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/contract_number { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .contract_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ string [::sargs::get $Data .type] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/type { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .type] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/serial_number { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .serial_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/customer_ref_name { ::if {$IsTest} {::return;} ::qw::bug 314120240111144002 "[::qw::procname] - this index is commented in the install code."; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/customer_ref_description { ::if {$IsTest} {::return;} ::qw::bug 314120240111144003 "[::qw::procname] - this index is commented in the install code."; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.contracts.index/expiry_date { ::if {$IsTest} {::return;} ::qw::bug 314120240111144004 "[::qw::procname] - this index is commented in the install code."; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.creditcards.index/issuer { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .issuer] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.creditcards.index/number { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.creditcards.index/expiry_date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::sargs::get $Data .expiry_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.serialnumbers.index/serial_number { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .serial_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.serialnumbers.index/nv2_serial_number { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .nv2_serial_number] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.serialnumbers.index/nv2_register_1_date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .nv2_register_1_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.serialnumbers.index/nv2_register_2_date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .nv2_register_2_date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE*.serialnumbers.index/nv2_upgrades_expiry_date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .nv2_upgrades_expiry_date] \ ]; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/AR*.prices.index/sales_account_ref_name { ::if {$IsTest} {::return;} ::set SalesAccount [::sargs::get $Data .sales_account]; ::if {$SalesAccount eq ""} { ::return [::list \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $SalesAccount]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR*.prices.index/sales_account_ref_description { ::if {$IsTest} {::return;} ::set SalesAccount [::sargs::get $Data .sales_account]; ::if {$SalesAccount eq ""} { ::return [::list \ string "" \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $SalesAccount]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT/AR*.prices.index/customer_sales_code { ::if {$IsTest} {::return;} ::set SalesAccount [::sargs::get $Data .sales_account]; ::if {$SalesAccount eq ""} { ::set Name ""; } else { ::set OS [$Database cpp_object_structure_load .address $SalesAccount]; ::set Name [::sargs::get $OS .data.name]; } ::return [::list \ string [::sargs::get $Data .customer_sales_code] \ string $Name \ ]; } } } /OBJECT/NEWVIEWS/ACCOUNT/SALES* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/SALES*.prices.index/customer_account_ref_name { ::if {$IsTest} {::return;} ::set Customer [::sargs::get $Data .customer_account]; ::if {$Customer eq ""} { ::return [::list \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $Customer]; ::return [::list string [::sargs::get $OS .data.name]]; } /OBJECT/NEWVIEWS/ACCOUNT/SALES*.prices.index/customer_account_ref_description { ::if {$IsTest} {::return;} ::set Customer [::sargs::get $Data .customer_account]; ::if {$Customer eq ""} { ::return [::list \ string "" \ string "" \ ]; } ::set OS [$Database cpp_object_structure_load .address $Customer]; ::return [::list string [::sargs::get $OS .data.description] string [::sargs::get $OS .data.name]]; } /OBJECT/NEWVIEWS/ACCOUNT/SALES*.prices.index/customer_sales_code { ::if {$IsTest} {::return;} ::set Result [::list string [::sargs::get $Data .customer_sales_code]]; ::set Customer [::sargs::get $Data .customer_account]; ::if {$Customer eq ""} { ::lappend Result string ""; } else { ::set OS [$Database cpp_object_structure_load .address $Customer]; ::lappend Result string [::sargs::get $OS .data.name]; } ::return $Result; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_path { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::puts "rwb_debug,2222.0,IndexPath==$IndexPath"; ::puts "rwb_debug,2222.1,key==[::list string [::qw::odb::odb_path_readable $sargs]]"; ::return [::list \ string [::qw::odb::odb_path_readable $sargs] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_path_backward { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::return [::list \ string [::qw::odb::odb_path_backward_readable $sargs] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_path_backward/posting { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {![::qw::odb::odb_is_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::qw::odb::odb_path_backward_readable $sargs] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name/root { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .total.parent1] ne ""} { ::return ""; } ::if {[::sargs::get $Data .total.parent2] ne ""} { ::return ""; } ::if {[::sargs::get $Data .total.parent3] ne ""} { ::return ""; } ::if {[::sargs::get $Data .total.parent4] ne ""} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure/posting { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {![::qw::odb::odb_is_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure/posting { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {![::qw::odb::odb_is_posting_account $sargs]} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure/branch { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/name_closure/leaf { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure/branch { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/description_closure/leaf { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/branch { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/leaf { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/posting { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {![::qw::odb::odb_is_posting_account $sargs]} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/report_tag { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::set ReportTag [::sargs::get $Data .report_tag]; ::if {$ReportTag eq ""} { ::return ""; } ::return [::list \ string $ReportTag \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/report_ref_odb_path_help_closure { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::set Collection [::sargs::get $Data .report]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/report_ref_odb_path_help_closure/posting { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::if {![::qw::odb::odb_is_posting_account $sargs]} { ::return ""; } ::set Collection [::sargs::get $Data .report]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/date1* { # Warning: date1 and reference1 have to precede date and reference in this "switch" ::if {$IsTest} {::return;} ::set Date1 [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date1]; ::if {$Date1 eq ""} { ::return ""; } ::return [::list \ date $Date1 \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/reference1* { # Warning: date1 and reference1 have to precede date and reference in this "switch" ::if {$IsTest} {::return;} ::set Reference1 [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference1]; ::if {$Reference1 eq ""} { ::return ""; } ::return [::list \ string $Reference1 \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/date* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::switch -- $Id { /open { ::if {![::qw::odb::posting_is_open $sargs]} { ::return ""; } } /closed { ::if {![::qw::odb::posting_is_closed $sargs]} { ::return ""; } } /debit { ::if {![::qw::odb::posting_is_debit $sargs]} { ::return ""; } } /credit { ::if {![::qw::odb::posting_is_credit $sargs]} { ::return ""; } } } ::return [::list \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/reconcile* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::switch -- $Id { /open { ::if {![::qw::odb::posting_is_open $sargs]} { ::return ""; } } /closed { ::if {![::qw::odb::posting_is_closed $sargs]} { ::return ""; } } /debit { ::if {![::qw::odb::posting_is_debit $sargs]} { ::return ""; } } /credit { ::if {![::qw::odb::posting_is_credit $sargs]} { ::return ""; } } } ::set PostingField [::sargs::outer .field [::qw::odb::field_extract .address $Reference]]; ::set Reconcile [::sargs::get $Data $PostingField.reconcile]; ::return [::list \ string $Reconcile \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/reference* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::switch -- $Id { /open { ::if {![::qw::odb::posting_is_open $sargs]} { ::return ""; } } /closed { ::if {![::qw::odb::posting_is_closed $sargs]} { ::return ""; } } /debit { ::if {![::qw::odb::posting_is_debit $sargs]} { ::return ""; } } /credit { ::if {![::qw::odb::posting_is_credit $sargs]} { ::return ""; } } } ::return [::list \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/description* { ::if {$IsTest} {::return;} ::set Id "/[::lindex [::split $IndexPath /] end]"; ::set ReferenceField [::qw::odb::field_extract .address $Reference]; ::set Reconcile [::sargs::get $OS .data$ReferenceField.reconcile]; ::switch -- $Id { /open { ::if {![::qw::odb::posting_is_open $sargs]} { ::return ""; } } /closed { ::if {![::qw::odb::posting_is_closed $sargs]} { ::return ""; } } /debit { ::if {![::qw::odb::posting_is_debit $sargs]} { ::return ""; } } /credit { ::if {![::qw::odb::posting_is_credit $sargs]} { ::return ""; } } } ::return [::list \ string [::sargs::get $OS .data.description] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/l1 { ::if {$IsTest} {::return;} ::set Value [::sargs::get $Data .l1]; ::if {$Value eq ""} { ::return ""; } ::return [::list \ string $Value \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/l2 { ::if {$IsTest} {::return;} ::set Value [::sargs::get $Data .l2]; ::if {$Value eq ""} { ::return ""; } ::return [::list \ string $Value \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/l3 { ::if {$IsTest} {::return;} ::set Value [::sargs::get $Data .l3]; ::if {$Value eq ""} { ::return ""; } ::return [::list \ string $Value \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/l4 { ::if {$IsTest} {::return;} ::set Value [::sargs::get $Data .l4]; ::if {$Value eq ""} { ::return ""; } ::return [::list \ string $Value \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/topic_path { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::transaction_topic_path $sargs] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.postings.index/topic_path_backward { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::transaction_topic_path_backward $sargs] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.addresses.index/name { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.addresses.index/description { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure { ::if {$IsTest} {::return;} ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ACCOUNT*.total.kids.index/name { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .name]]; } /OBJECT/NEWVIEWS/ACCOUNT*.total.kids.index/description { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } } } /OBJECT/NEWVIEWS/JOURNAL* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/JOURNAL/PAYROLL* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/JOURNAL/PAYROLL/TIMECARD* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/JOURNAL/PAYROLL/TIMECARD*.transactions.index/paycheck_ref_reference { ::if {$IsTest} {::return;} ::set Reference [::sargs::get $Data .paycheck]; ::if {$Reference eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::sargs::get $OS .data.reference] \ ]; } } } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_path_backward { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::odb_path_backward_readable $sargs] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/journal_type { ::if {$IsTest} {::return;} ::while {![::sargs::boolean_get $OS .system.is_class]} { ::set OS [$Database cpp_object_structure_load .address [::sargs::get $OS .data.odb_base]]; } ::return [::list \ string [::sargs::get $OS .data.name] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure/active { ::if {$IsTest} {::return;} ::if {[::sargs::boolean_get $OS .system.is_class]} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::if {[::qw::odb::journal_default_field_odb_get $sargs .field_path .active] ne "active"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure/active { ::if {$IsTest} {::return;} ::if {[::sargs::boolean_get $OS .system.is_class]} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::if {[::qw::odb::journal_default_field_odb_get $sargs .field_path .active] ne "active"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/journal_type/active { ::if {$IsTest} {::return;} ::if {[::sargs::boolean_get $OS .system.is_class]} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::if {[::qw::odb::journal_default_field_odb_get $sargs .field_path .active] ne "active"} { ::return ""; } ::while {![::sargs::boolean_get $OS .system.is_class]} { ::set OS [$Database cpp_object_structure_load .address [::sargs::get $OS .data.odb_base]]; } ::return [::list \ string [::sargs::get $OS .data.name] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/name_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/description_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure { ::if {$IsTest} {::return;} ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/active { ::if {$IsTest} {::return;} ::if {[::sargs::boolean_get $OS .system.is_class]} { ::return ""; } ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::if {[::qw::odb::journal_default_field_odb_get $sargs .field_path .active] ne "active"} { ::return ""; } ::set Reference [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.transactions.index/date1 { ::if {$IsTest} {::return;} ::set Value [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date1]; ::if {$Value eq ""} { ::return ""; } ::return [::list date $Value]; } /OBJECT/NEWVIEWS/JOURNAL*.transactions.index/reference1 { ::if {$IsTest} {::return;} ::set Value [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference1]; ::if {$Value eq ""} { ::return ""; } ::return [::list \ string $Value \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.transactions.index/date { ::if {$IsTest} {::return;} ::if {!$::qw::control(crm_include)} { ::return [::list \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } ::return [::list \ date [::sargs::get $Data .time_start] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.transactions.index/reference { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/JOURNAL*.transactions.index/description { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ ]; } } } /OBJECT/NEWVIEWS/REPORT* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/name_closure { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/name_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/name_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/name_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/name_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/description_closure { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/description_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/description_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/description_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/description_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/folder { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/file { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .folder] ne "file"} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/branch { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]==0} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/REPORT*.odb_deriveds.index/odb_base_ref_odb_path_help_closure/leaf { ::if {$IsTest} {::return;} ::if {[::qw::odb::odb_deriveds_record_count $sargs]!=0} { ::return ""; } ::set Collection [::sargs::get $Data .odb_base]; ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/REPORT*.accounts.index/name { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT/NEWVIEWS/REPORT*.accounts.index/description { ::if {$IsTest} {::return;} ::if {[::sargs::get $Data .line_type] eq "text_line"} { ::return ""; } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } } } /OBJECT/NEWVIEWS/PAYROLL* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/PAYROLL/CANADA* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/PAYROLL/CANADA.roes.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .date] \ ]; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/PAYROLL*.paychecks.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.paychecks.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.paychecks.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.payroll_reports.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .end_date] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.payruns.index/check_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .check_date] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.timecards.index/date { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.timecards.index/reference { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::qw::odb::transaction_default_field_odb_get $sargs .field_path .reference] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.timecards.index/description { ::if {$IsTest} {::return;} ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $Data .description] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.timecards.index/paycheck_ref_reference { ::if {$IsTest} {::return;} ::set Reference [::sargs::get $Data .paycheck]; ::if {$Reference eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Reference]; ::return [::list \ tag [::lindex [::sargs::get $Data .tags] 0] \ string [::sargs::get $OS .data.reference] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.employees.index/employee_id { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .employee_id] \ ]; } /OBJECT/NEWVIEWS/PAYROLL*.employees.index/employee_name { ::if {$IsTest} {::return;} ::set Name [::qw::odb::employee_name_formatted .format $::qw::name::formats(sortable) .object_structure $OS]; ::return [::list \ string $Name \ ]; } } } /OBJECT/NEWVIEWS/ADDRESS* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ADDRESS*.odb_deriveds.index/account_ref_name { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .account]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/NEWVIEWS/ADDRESS*.odb_deriveds.index/account_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .account]; ::if {$Collection eq ""} { ::return [::list string "" string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/NEWVIEWS/ADDRESS*.odb_deriveds.index/address_inner_company { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .address.company] \ ]; } } } /OBJECT/NEWVIEWS/ATTACHMENT* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_host { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .import_source_host] \ string [::file dirname [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_folder { ::if {$IsTest} {::return;} ::return [::list \ string [::file dirname [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_filename { ::if {$IsTest} {::return;} ::return [::list \ string [::file tail [::sargs::get $Data .import_source_path]] \ string [::file dirname [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_file_type { ::if {$IsTest} {::return;} ::return [::list \ string [::file extension [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_file_size { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .import_source_file_size] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_source_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .import_source_date] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/import_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .import_date] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/object_attachments_ref_odb_path_help { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .object_attachments]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS/ATTACHMENT*.odb_deriveds.index/object_attachments_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .object_attachments]; ::if {$Collection eq ""} { ::return [::list string "" string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS*.attachments.index/name { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .name]]; } /OBJECT/NEWVIEWS*.attachments.index/description { ::if {$IsTest} {::return;} ::return [::list string [::sargs::get $Data .description] string [::sargs::get $Data .name]]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_host { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .import_source_host] \ string [::file dirname [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_folder { ::if {$IsTest} {::return;} ::return [::list \ string [::file dirname [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_filename { ::if {$IsTest} {::return;} ::return [::list \ string [::file tail [::sargs::get $Data .import_source_path]] \ string [::file dirname [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_file_type { ::if {$IsTest} {::return;} ::return [::list \ string [::file extension [::sargs::get $Data .import_source_path]] \ string [::file tail [::sargs::get $Data .import_source_path]] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_file_size { ::if {$IsTest} {::return;} ::return [::list \ integer [::sargs::get $Data .import_source_file_size] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_source_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .import_source_date] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/import_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .import_date] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/object_attachments_ref_odb_path_help { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .object_attachments]; ::if {$Collection eq ""} { ::return [::list string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } /OBJECT/NEWVIEWS*.attachments.index/object_attachments_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .object_attachments]; ::if {$Collection eq ""} { ::return [::list string "" string ""]; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::qw::odb::odb_path_help $sargs .object_structure $OS] \ ]; } } } /OBJECT/SERVER* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/PORT* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/PORT.connections.index/file { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .database]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.file] \ ]; } /OBJECT/SERVER/PORT.connections.index/login_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SERVER/PORT.database_groups.index/name { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT/SERVER/PORT.database_groups.index/description { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } /OBJECT/SERVER/PORT.databases.index/file { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .file] \ ]; } /OBJECT/SERVER/PORT.odb_deriveds.index/number { ::if {$IsTest} {::return;} ::return [::list \ integer [::sargs::get $Data .number] \ ]; } /OBJECT/SERVER/PORT.odb_deriveds.index/state { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .state] \ ]; } } } /OBJECT/SERVER/PORT/DATABASE_GROUP* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/DATABASE_GROUP.connections.index/file { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .database]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.file] \ ]; } /OBJECT/SERVER/DATABASE_GROUP.connections.index/login_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SERVER/DATABASE_GROUP.databases.index/file { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .file] \ ]; } } } /OBJECT/SERVER/PORT/DATABASE* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/DATABASE_GROUP.connections.index/file { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .database]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.file] \ ]; } /OBJECT/SERVER/DATABASE_GROUP.connections.index/login_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .login_date] \ ]; } /OBJECT/SERVER/DATABASE_GROUP.databases.index/file { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .file] \ ]; } } } /OBJECT/SERVER/PORT/CENNECTION* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/CONNECTION*.odb_deriveds.index/hostname { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .workstation.hostname] \ ]; } /OBJECT/SERVER/CONNECTION*.odb_deriveds.index/username { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .workstation.username] \ ]; } /OBJECT/SERVER/CONNECTION*.odb_deriveds.index/file { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .database]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.file] \ ]; } /OBJECT/SERVER/CONNECTION*.odb_deriveds.index/login_date { ::if {$IsTest} {::return;} # rwb_debug - shouldn't this be a date type? ::return [::list \ string [::sargs::get $Data .login_date] \ ]; } } } } } /OBJECT/WORKSTATION* { ::switch -glob -- $IndexPath { /OBJECT/WORKSTATION/LOGIN* { ::switch -glob -- $IndexPath { /OBJECT/WORKSTATION/LOGIN*.odb_deriveds.index/server { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .server] \ ]; } /OBJECT/WORKSTATION/LOGIN*.odb_deriveds.index/file { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .file] \ ]; } /OBJECT/WORKSTATION/LOGIN*.odb_deriveds.index/database_group { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .database_group] \ string [::sargs::get $Data .file] \ ]; } /OBJECT/WORKSTATION/LOGIN*.odb_deriveds.index/state { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .state] \ ]; } } } } } /OBJECT/DATAEASE* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/SUPPORTREP* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/SUPPORTREP*.odb_deriveds.index/rep_name { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .rep_name.last] \ string [::sargs::get $Data .rep_name.first] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/l1 { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .l1] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/l2 { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .l2] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/l3 { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .l3] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/l4 { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .l4] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/topic_path { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::transaction_topic_path $sargs] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } /OBJECT/DATAEASE/SUPPORTREP*.contacts.index/topic_path_backward { ::if {$IsTest} {::return;} ::return [::list \ string [::qw::odb::transaction_topic_path_backward $sargs] \ date [::qw::odb::transaction_default_field_odb_get $sargs .field_path .date] \ ]; } } } /OBJECT/DATAEASE/CONTRACT* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/contract_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .contract_number] \ ]; } /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .date] \ string [::sargs::get $Data .type] \ ]; } /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/type { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .type] \ date [::sargs::get $Data .date] \ ]; } /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/serial_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .serial_number] \ ]; } /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/customer_ref_name { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/DATAEASE/CONTRACT*.odb_deriveds.index/customer_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } } } /OBJECT/DATAEASE/CREDITCARD* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/CREDITCARD*.odb_deriveds.index/issuer { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .issuer] \ ]; } /OBJECT/DATAEASE/CREDITCARD*.odb_deriveds.index/number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .number] \ ]; } /OBJECT/DATAEASE/CREDITCARD*.odb_deriveds.index/expiry_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .expiry_date] \ ]; } /OBJECT/DATAEASE/CREDITCARD*.odb_deriveds.index/customer_ref_name { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/DATAEASE/CREDITCARD*.odb_deriveds.index/customer_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } } } /OBJECT/DATAEASE/SERIALNUMBER* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/old_serial_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .old_serial_number] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/serial_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .serial_number] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/nv2_serial_number { ::if {$IsTest} {::return;} ::return [::list \ string [::sargs::get $Data .nv2_serial_number] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/nv2_upgrades_expiry_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .nv2_upgrades_expiry_date] \ string [::sargs::get $Data .nv2_serial_number] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/customer_ref_name { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/customer_ref_description { ::if {$IsTest} {::return;} ::set Collection [::sargs::get $Data .customer]; ::if {$Collection eq ""} { ::return ""; } ::set OS [$Database cpp_object_structure_load .address $Collection]; ::return [::list \ string [::sargs::get $OS .data.description] \ string [::sargs::get $OS .data.name] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/nv2_register_1_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .nv2_register_1_date] \ ]; } /OBJECT/DATAEASE/SERIALNUMBER*.odb_deriveds.index/nv2_register_2_date { ::if {$IsTest} {::return;} ::return [::list \ date [::sargs::get $Data .nv2_register_2_date] \ ]; } } } } } } } } ::switch -glob -- $IndexPath { /OBJECT*.odb_deriveds.index/name* { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .name] \ ]; } /OBJECT*.odb_deriveds.index/description* { ::if {$IsTest} {::return;} ::if {[::string first "/folder" $IndexPath]>=0} { ::if {[::sargs::get $Data .folder] ne "folder"} { ::return ""; } } ::return [::list \ string [::sargs::get $Data .description] \ string [::sargs::get $Data .name] \ ]; } } ::qw::bug 314120231007172737 "[::qw::procname] - invalid path \"$IndexPath\"."; } ::proc ::qw::odb::active_index::garbage_collect {sargs} { # ------------------------------------------------------------ # Deletes expired /odb/active_index records and their /odb/index index records. # ------------------------------------------------------------ /* { Things that make hoi take so long. (1) Comparing interactive to primary - audit interactive - about 7M items - don't know what we can do about it. - maybe unilaterally delete the interactive and let them start over. - currently takes about 15 minutes (2) Deleting AUDIT.index/date and all other audit indexes - we and delete the file without a node for greater speed. - we will need a specific file open .empty_range argument to prevent bug - deleting .odb_deriveds.index/date took about - these files had about 7M records - takes about 80 70 seconds for each file (node) (3) */ } ::set rwb1_debug 0; ::if {$::qw::verbose(active_index)} { ::set rwb1_debug 2; } ::set Database [::sargs::get $sargs .database]; ::if {$Database eq ""} { ::qw::bug 314120231005165157 "[::qw::procname] - no .database argument."; } ::set Lifespan $::qw::control(active_index_lifespan); ::if {[::sargs::exists $sargs .active_index_lifespan]} { /* { .active_index_lifespan argument overrides default lifspan Note if you call with a zero lifespan then every index will be made inactive. */ } ::set Lifespan [::sargs::integer_get $sargs .active_index_lifespan]; } ::set DatabaseId [$Database cpp_database_id_get]; ::set DatabasePath [$Database cpp_database_path]; ::set ActiveIndexFile [$Database cpp_file_factory]; ::qw::finally [::list $ActiveIndexFile cpp_destroy]; $ActiveIndexFile cpp_file_open .path "/odb/active_index"; ::if {$rwb1_debug} {::puts "rwb1_debug,garbage_collect,1000.0,record_count==[$ActiveIndexFile cpp_record_count]";} ::set ProgressMinimum 1000; ::set ProgressLimit [$ActiveIndexFile cpp_record_count]; ::set Progress ""; ::if {$ProgressLimit>=$ProgressMinimum} { ::if {$Lifespan!=0} { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id $DatabaseId \ .database_path $DatabasePath \ .limit $ProgressLimit \ .operation "Deleting expired indexes" \ .state "working" \ .status "$DatabasePath deleting expired indexes." \ .destroy_skip 0 \ ]; } else { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id $DatabaseId \ .database_path $DatabasePath \ .limit $ProgressLimit \ .operation "Making indexes inactive." \ .state "working" \ .status "$DatabasePath making most indexes inactive." \ .destroy_skip 0 \ ]; } ::qw::finally [::list ::itcl::delete object $Progress]; ::set ProgressAccumulator 0; } ::for {::set Before [$ActiveIndexFile cpp_record_first]} {[::sargs::size $Before]!=0} {::set Before [$ActiveIndexFile cpp_record_next $Before];} { # ------------------------------------------------------------ # Traverse /odb/active_index. # ------------------------------------------------------------ ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=19} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set Key [::sargs::get $Before .key]; ::set ObjectId [::lindex $Key end]; ::set Address [::qw::odb::address_from_object_id .database $Database .object_id $ObjectId]; ::if {[::qw::command_exists $Address]} { /* { We can deal with this later if necessary by getting the AIS from the odb object. */ } ::qw::bug 314120231120092144 "[::qw::procname] - garbage collection was run on an active odb object manager."; } ::set AISBefore [::sargs::get $Before .data]; ::puts "garbage_collection,3000.1,AISBefore==\n[::sargs::format $AISBefore]"; /* { Note are loading the OS because we assume garbage collect is a low-level operation, meaning there is no object manager. We could inseta check is the object is loaded in an object manager as we do elsewhere. */ } ::set OS [$Database cpp_object_structure_load .object_id $ObjectId]; /* { The next call removes from the AIS (active_index_structure) any index fields that have expired, returning the new pruned AIS and the list of index fields that expired. */ } ::set PruneResult [::qw::odb::active_index::garbage_collect_one_active_index_structure \ .database $Database \ .active_index_record $Before \ .object_structure $OS \ .active_index_lifespan $Lifespan \ ]; ::set AISAfter [::sargs::get $PruneResult .active_index_structure]; ::puts "garbage_collection,3000.5,AISAfter==\n[::sargs::format $AISAfter]"; ::if {![::sargs::values_are_equal $AISBefore $AISAfter]} { /* { Even if the expired index list is empty the AIS can change because, for example, an interactive index, although expired, might have changed from the primary, and thus it's .is_always_active flag changed. If the AIS changed, we may as well write it here. */ } ::if {[::sargs::size $AISAfter]!=0} { # ------------------------------------------------------------ # Write the new AIS After record. # ------------------------------------------------------------ ::puts "garbage_collection,3000.6,ExpiredIndexFieldPathList==\n[::sargs::get $PruneResult .expired_index_field_path_list]"; ::set After $Before; ::sargs::var::set After .data [::sargs::normalize $AISAfter]; $ActiveIndexFile cpp_record_write .before $Before .after $After; } else { # ------------------------------------------------------------ # No remaining active indexes. Delete the AIS Before record. # ------------------------------------------------------------ ::puts "garbage_collection,3000.7,ExpiredIndexFieldPathList==\n[::sargs::get $PruneResult .expired_index_field_path_list]"; $ActiveIndexFile cpp_record_delete .before $Before; } } ::puts "garbage_collection,3000.8"; ::set ExpiredIndexFieldPathList [::sargs::get $PruneResult .expired_index_field_path_list]; ::if {[::llength $ExpiredIndexFieldPathList]==0} { # ------------------------------------------------------------ # No indexes in this AIS record became inactive. Nothing to do. # ------------------------------------------------------------ ::puts "garbage_collection,3000.9"; ::continue; } ::puts "garbage_collection,3000.10"; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set MasterPath [::sargs::get $OS .system.path]; ::foreach IndexFieldPath $ExpiredIndexFieldPathList { /* { We are only processing AIS records that exist and hence have index fields for active indexes within. Then we are only processing the fields for active indexes bacause they all have a .last_access field. So we are only processing indexes that can indeed be made inactive, except possibly for interactive indexes that do not have the .is_always_active field set. */ } ::switch -glob -- $IndexFieldPath { .index - .index/id - .index/id_closure - .attachments.index/interactive - .employees.index/interactive - .payruns.index/interactive - .databases.index/interactive { ::qw::bug 314120240105172616 "[::qw::procname] - invalid index \"$IndexFieldPath\""; } } ::set IndexFilePath /odb/index$ClassPath$IndexFieldPath; /* { An interactive index can be made inactive if it is identical to the the primary (.index/id) index. That is, it is the same size and sort order. */ } ::if {[::sargs::boolean_get $AISBefore $IndexFieldPath.is_always_active]} { /* { This interactive index can never be made inactive because it has been used or changed in the past and no longer matches the primary. Currently only used for interactive indexes but the concept is more general. */ } ::qw::bug 314120231120094054 "[::qw::procname] - interactive is always active so cannot be in expired index list."; } ::if {$rwb1_debug} { ::set IndexRecordCount [$Database cpp_file_record_count \ .path $IndexFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ]; } ::puts "garbage_collection,3000.11"; ::if {[::qw::odb::index_is_interactive .path $IndexFieldPath]} { /* { The interactive is the same as the primary. We can make the interactive inactive. */ } # ------------------------------------------------------------ # Delete the interactive index records. # ------------------------------------------------------------ ::if {1} { ::set Seconds [::clock seconds]; } ::puts "garbage_collection,3000.12"; $Database cpp_file_delete_all_records \ .path $IndexFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ .progress_color "red" \ ; ::puts "garbage_collection,3000.13"; # ------------------------------------------------------------ # Delete the index's odometer file records. # ------------------------------------------------------------ /* { Kludge alert. Appended "!" to end of odometer file range. Otherwise .../interactive range would include .../interactive/folder. */ } $Database cpp_file_delete_all_records \ .path /odb/odometer \ .range.begin [::list string "/$ObjectId$IndexFieldPath"] \ .range.end [::list string "/$ObjectId$IndexFieldPath!"] \ .progress_color "red" \ ; ::puts "garbage_collection,3000.14"; ::if {1} { ::set Seconds [::expr {[::clock seconds]-$Seconds}]; ::if {$Seconds>0} { ::if {$rwb1_debug} {::puts "rwb1_debug,garbage_collection,1000.6,interactive,make_inactive,field==$IndexFieldPath,RecordCount==$IndexRecordCount,Seconds==$Seconds";} } } ::continue; } # ------------------------------------------------------------ # delete /odb/index records. # ------------------------------------------------------------ ::if {1} { ::set Seconds [::clock seconds]; } ::puts "garbage_collection,3000.15"; $Database cpp_file_delete_all_records \ .path $IndexFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ .progress_color "red" \ ; ::puts "garbage_collection,3000.16"; ::if {1} { ::set Seconds [::expr {[::clock seconds]-$Seconds}]; ::if {$Seconds>0} { ::if {$rwb1_debug} {::puts "rwb1_debug,garbage_collection,1000.6,regular,make_inactive,field==$IndexFieldPath,RecordCount==$IndexRecordCount,Seconds==$Seconds";} } } } } ::puts "garbage_collection,3000.99"; ::if {$Progress ne ""} { ::if {$ProgressAccumulator!=0} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } } ::proc ::qw::odb::active_index::garbage_collect_one_active_index_structure {sargs} { /* { Usage: ::set Result [::qw::odb::active_index::garbage_collect_one_active_index_structure \ .database $Database \ .object_structure $OS \ .active_index_record $Record \ .active_index_lifespan $Seconds \ ]; Takes an active_index_record and prunes expired indexes from the structure. Returns the resulting active_index_structure and the list of pruned index fields. The lifespan argument, in seconds, is optional and overrides the global default, ::qw::control(active_index_lifespan). Note: We need a record as an argument, not just an AIS by itself, because we need to get the object_id from the record key. Returns a structure: .expired_index_field_path_list ... # list of index field paths that have just been removed from AIS .active_index_structure ... # remaining AIS after pruning inactive index fields. If the lifespan is zero, any index that can be deactivated, will be. */ } ::set rwb1_debug 0; ::set Database [::sargs::get $sargs .database]; ::set Record [::sargs::get $sargs .active_index_record]; ::set Lifespan $::qw::control(active_index_lifespan); ::set OS [::sargs::get $sargs .object_structure]; ::if {[::sargs::exists $sargs .active_index_lifespan]} { ::set Lifespan [::sargs::integer_get $sargs .active_index_lifespan]; } ::set AIS [::sargs::get $Record .data]; ::set Key [::sargs::get $Record .key]; ::set ObjectId [::lindex $Key end]; ::if {$rwb1_debug} {::puts "rwb1_debug,structure_garbage_collection.1000.0,clock==[::clock format [::clock seconds]]";} ::if {[::sargs::size $OS]==0} { ::set OS [$Database cpp_object_structure_load .object_id $ObjectId]; } ::set ClassPath [::sargs::get $OS .system.class_path]; ::set MasterPath [::sargs::get $OS .system.path]; # ------------------------------------------------------------ # Use sargs::select_field to get a list of AIS entries for active indexes. # ------------------------------------------------------------ ::if {$rwb1_debug} {::puts "rwb1_debug,structure_garbage_collection.1000.1,clock==[::clock format [::clock seconds]]";} ::set IndexFieldPathList [::sargs::select_field .structure $AIS .field .last_access]; ::set ExpiredIndexFieldPathList [::list]; ::set InteractiveFile [$Database cpp_file_factory]; ::qw::finally [::list $InteractiveFile cpp_destroy]; ::set Seconds [::clock seconds]; ::foreach IndexFieldPath $IndexFieldPathList { # ------------------------------------------------------------ # Process each AIS record index field to delete expired active indexes. # ------------------------------------------------------------ ::if {$rwb1_debug} {::puts "rwb1_debug,structure_garbage_collection.1000.2,IndexFieldPath==$IndexFieldPath,clock==[::clock format [::clock seconds]]";} ::set IsAlwaysActive [::sargs::boolean_get $AIS $IndexFieldPath.is_always_active]; ::if {$IsAlwaysActive} { /* { Interactive indexes can be inactive but once they have been manipulated and no longer match the primary, they contain information and can no longer be made inactive. Currently this field is only used for interactive indexes but other situations may arise so we make the check without knowing whether index is interactive or not. */ } ::continue; } ::set IndexIsInteractive [::qw::odb::index_is_interactive .path $IndexFieldPath]; ::set LastAccess [::sargs::get $AIS $IndexFieldPath.last_access]; ::if {$Seconds-$LastAccess<=$Lifespan} { # ------------------------------------------------------------ # Skip index if lifespan has not expired. (Lifespan of 0 will deactivate). # ------------------------------------------------------------ ::continue; } # ------------------------------------------------------------ # Index has expired. # ------------------------------------------------------------ ::set IndexFilePath /odb/index$ClassPath$IndexFieldPath; ::if {$IndexIsInteractive} { /* { If the index is interactive and it is not identical to the primary, then we cannot make it inactive. It is information bearling. We already know that it's .is_always_active field has not been set in the active index structure. So it is possible that we can make this interactive index inactive if it is still the same as the primary. This will also be the case for many interactives right after we convert a database to 2.38.X. */ } ::set InteractiveEqualsPrimary [::qw::odb::active_index::interactive_equals_primary \ .database $Database \ .interactive_file_path $IndexFilePath \ .index_object_id $ObjectId \ ]; ::if {!$InteractiveEqualsPrimary} { # ------------------------------------------------------------ # Interactive no longer equals primary. Set .is_always_active to true. # ------------------------------------------------------------ ::sargs::var::set AIS $IndexFieldPath.is_always_active 1; ::continue; } # ------------------------------------------------------------ # Expired interactive that matches primary. Flow through to add to expired list. # ------------------------------------------------------------ } # ------------------------------------------------------------ # Unset inactive index's interactive index structure .last_access field. # ------------------------------------------------------------ ::lappend ExpiredIndexFieldPathList $IndexFieldPath; ::sargs::var::unset AIS $IndexFieldPath.last_access; } # ------------------------------------------------------------ # Prune AIS of empty fields, potentially even making structure empty. # ------------------------------------------------------------ ::if {$rwb1_debug} {::puts "rwb1_debug,structure_garbage_collection.1000.3,clock==[::clock format [::clock seconds]]";} ::set AIS [::sargs::prune .structure $AIS]; # remove empty fields. # ------------------------------------------------------------ # Return the remaining AIS and the list of index fields made inactive. # ------------------------------------------------------------ ::if {$rwb1_debug} {::puts "rwb1_debug,structure_garbage_collection.1000.4,clock==[::clock format [::clock seconds]]";} ::return [::sargs \ .active_index_structure $AIS \ .expired_index_field_path_list $ExpiredIndexFieldPathList \ ]; } ::proc ::qw::odb::active_index::interactive_equals_primary {sargs} { /* { We compare the interactive file to the primary file. By compare, we mean compare their reference components, traversing in the same direction. By file, we mean the range on the file representing the indexes on the same collection. If an interactive index is identical to the primary index, and it has expired, we can make the interactive index inactive. Suppose we just converted a database to version with active_indexes. There are likely to be many interactive indexes that match the primary and therefore they will eventually expire and can be garbage collected (made inactive). A good example will be distribution items if they are created by appending. The interactive index will be in the same order as the primery. If the user does later manipulate the interactive index then the interactive will be built at a likely unnoticable speed, and marked .is_always_active. */ } ::set rwb1_debug 1; ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.0,sargs==$sargs";} ::set Database [::sargs::get $sargs .database]; ::set DatabaseId [$Database cpp_database_id]; ::set DatabasePath [$Database cpp_database_path]; ::set InteractiveFilePath [::sargs::get $sargs .interactive_file_path]; ::set IndexObjectId [::sargs::get $sargs .index_object_id]; /* { The primary has the same collection field as extracted from the interactive file path. */ } ::set PrimaryFilePath [::qw::odb::collection_from_index_extract .path $InteractiveFilePath].index/id; ::set PrimaryFile [$Database cpp_file_factory]; ::qw::finally [::list $PrimaryFile cpp_destroy]; ::set InteractiveFile [$Database cpp_file_factory]; ::qw::finally [::list $InteractiveFile cpp_destroy]; $PrimaryFile cpp_file_open \ .path $PrimaryFilePath \ .range.begin [::list string $IndexObjectId] \ .range.end [::list string $IndexObjectId] \ ; $InteractiveFile cpp_file_open \ .path $InteractiveFilePath \ .range.begin [::list string $IndexObjectId] \ .range.end [::list string $IndexObjectId] \ ; ::set PrimaryRecordCount [$PrimaryFile cpp_record_count]; ::set InteractiveRecordCount [$InteractiveFile cpp_record_count]; ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.1,PrimaryRecordCount==$PrimaryRecordCount,InteractiveRecordCount==$InteractiveRecordCount";} ::if {$PrimaryRecordCount!=$InteractiveRecordCount} { ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.2,sargs==$sargs";} ::return 0; } ::set ProgressMinimum 1000; ::set ProgressLimit $PrimaryRecordCount; ::set Progress ""; ::if {$ProgressLimit>=$ProgressMinimum} { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id $DatabaseId \ .database_path $DatabasePath \ .limit $ProgressLimit \ .operation "Comparing interactive index to primary" \ .state "working" \ .status "Comparing interactive index $InteractiveFilePath to primary." \ .destroy_skip 0 \ ]; ::qw::finally [::list ::itcl::delete object $Progress]; ::set ProgressAccumulator 0; } ::set PrimaryRecord [$PrimaryFile cpp_record_first]; ::set InteractiveRecord [$InteractiveFile cpp_record_first]; ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.3,clock==[::clock format [::clock seconds]]";} ::while {[::sargs::size $PrimaryRecord]!=0} { ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=19} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set PrimaryKey [::sargs::get $PrimaryRecord .key]; ::set PrimaryReference [::lindex $PrimaryKey end]; ::set InteractiveKey [::sargs::get $InteractiveRecord .key]; ::set InteractiveReference [::lindex $InteractiveKey end]; ::if {$PrimaryReference ne $InteractiveReference} { ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.4.0,sargs==$sargs";} ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.4.0,InteractiveFilePath==$InteractiveFilePath";} ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.4.1,PrimaryRecord==[::sargs::normalize $PrimaryRecord]";} ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.4.2,Interactive ==[::sargs::normalize $InteractiveRecord]";} ::return 0; } ::set PrimaryRecord [$PrimaryFile cpp_record_next .key $PrimaryKey]; ::set InteractiveRecord [$InteractiveFile cpp_record_next .key $InteractiveKey]; } ::if {$Progress ne ""} { ::if {$ProgressAccumulator!=0} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::if {$rwb1_debug} {::puts "rwb1_debug,interactive_equals_primary,1000.5,clock==[::clock format [::clock seconds]]";} ::return 1; } /* { Collections .index/id .is_closure 0 - subs are a mixture /OBJECT.odb_deriveds all 0 /OBJECT/SYSTEM/AUDIT.odb_deriveds all 0 /OBJECT/SYSTEM/SESSION.odb_deriveds all 0 /OBJECT/NEWVIEWS/REPORT.odb_deriveds all 1 /OBJECT/NEWVIEWS/ACCOUNT.odb_deriveds all 1 except 1 index /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION.odb_deriveds all 0 (only 2 new indexes) /OBJECT/NEWVIEWS/JOURNAL.odb_deriveds all 1 /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE.odb_deriveds all 0 (only 1 new index) /OBJECT/NEWVIEWS/ADDRESS.odb_deriveds all 0 /OBJECT/NEWVIEWS/ACCOUNT.postings - mixture but could all be changed to 1 /OBJECT/NEWVIEWS/PAYROLL.employees - mixture /OBJECT/NEWVIEWS/ATTACHMENT.odb_deriveds.index - mixture - these were all added by active_index and should be changed to is_closure 1 /OBJECT/NEWVIEWS/PAYROLL.payruns - only sub is a 1 - base could be 1 /OBJECT/NEWVIEWS/PAYROLL.payroll_reports - only sub is a 1 - base could be 1 /OBJECT/NEWVIEWS/PAYROLL/CANADA.roes - only sub is a 1 - base could be 1 /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE/CANADA.roes - only sub is a 1 - base could be 1 - subs are all 0 /OBJECT.access_froms /OBJECT/SYSTEM/USER.access_tos /OBJECT/NEWVIEWS/REPORT.accounts /OBJECT/NEWVIEWS/ACCOUNT.total.kids /OBJECT/NEWVIEWS/ACCOUNT.addresses /OBJECT/NEWVIEWS/ACCOUNT/AR.prices /OBJECT/NEWVIEWS/ACCOUNT/SALES.prices /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE.accounts Collections .index/id .is_closure 1 - subs are a mixture - subs are all 1 /OBJECT/SYSTEM/USER.sessions /OBJECT/SYSTEM/USER.audit_trail /OBJECT/NEWVIEWS.attachments /OBJECT/NEWVIEWS/JOURNAL.transactions /OBJECT/NEWVIEWS/JOURNAL/PAYROLL/TIMECARD.transactions /OBJECT/NEWVIEWS/SYSTEM/PAYRUN.paychecks /OBJECT/NEWVIEWS/SYSTEM/PAYRUN.timecards /OBJECT/NEWVIEWS/PAYROLL.paychecks /OBJECT/NEWVIEWS/PAYROLL.timecards /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE.paychecks /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE.timecards /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK.timecards */ } ::proc ::qw::odb::active_index::collection_enable_populate_postings_index_id {sargs} { /* { When ACCOUNT.postings becomes enabled, this method populates ACCOUNT.postings.index/id from cross-section of enabled descendents below. This works in general but currently only applies to ACCOUNT.postings and JOURNAL.transactions. When the collection is disabled, all indexes including .index/id are inactive. When the collection becomes enabled, we populate the .index/id index by recursively gathering the records from below, .odb_deriveds.index/id for .transactions, or .total.kids.index/id for .postings. We only dive down until we hit an enabled collection. Whenever we visit an enabled collection we copy it's ,index/id index to the root. We dive no further under an enabled collection. Note: We are using a switch in the base method instead of using overriding methods in JOURNAL.transactions and ACCOUNT.postings. This is bad programming but keeps everything in one place. Note: This is implemented in high-level code so we can't use low-level code to enable a collection. It would actually be very easy to move this method ro a low-level proc. */ } ::if {!$::qw::control(active_index_is_enabled)} { ::qw::bug 314120241119104218 "[::qw::methodname] - invalid method call."; } ::set RootAccount [::sargs::get $sargs .root_account]; ::set Command [::sargs::get $sargs .command]; ::set Account [::sargs::get $sargs .account]; ::if {$Account eq ""} { ::set Account $RootAccount; } ::set Database [::sargs::get $sargs .database]; ::if {$Command eq ""} { ::set AccountList [[::qw::procname] $sargs .command "get_enabled_account_list"]; } ::if {$Command eq "get_enabled_account_list"} { /* { get_enabled_account_list makes the method recursive. We gather up a cross-section of accounts below that are enbled. These are the ones whose postings we will copy to the root account. The root account is the account whose .index/id we are populating. */ } ::set OS [$Database cpp_object_structure_load .address $Account]; ::set IsEnabled [::sargs::boolean_get $OS .data.postings_collection_is_enabled]; ::if {$IsEnabled} { ::if {$Account eq $RootAccount} { ::qw::bug 314120241119170549 "[::qw::procname] - root collection should not be enabled."; } ::return [::list $Account]; } ::set AccountList [::list]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.total.kids.index/id"; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set IfsFile [$Database cpp_file_factory]; ::qw::finally [::list $IfsFile cpp_destroy]; $IfsFile cpp_file_open \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::for {::set Record [$IfsFile cpp_record_first]} {[::sargs::size $Record]!=0} {::set Record [$IfsFile cpp_record_next $Record]} { ::set Kid [::lindex [::sargs::get $Record .key] end]; ::set KidAccountList [[::qw::procname] $sargs .account $Kid]; ::set AccountList [::concat $AccountList $KidAccountList]; } ::return $AccountList; } /* { At this point we have the list of enabled accounts from below. Note that this is not particularly scalable but simpler to manage a progress box when not implemented recursively. */ } ::set RecordCount 0; ::foreach Account $AccountList { # ------------------------------------------------------------ # Get the total count of records to be copied. # ------------------------------------------------------------ ::set OS [$Database cpp_object_structure_load .address $Account]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.postings.index/id"; ::set ObjectId [::sargs::get $OS .system.object_id]; ::incr RecordCount [$Database cpp_file_record_count \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ]; } ::set RootAccountOS [$Database cpp_object_structure_load .address $RootAccount]; ::set RootClassPath [::sargs::get $RootAccountOS .system.class_path]; ::set RootObjectId [::sargs::get $RootAccountOS .system.object_id]; ::set RootName [::sargs::get $RootAccountOS .data.name]; ::set ProgressLimit $RecordCount; ::set Progress ""; ::if {$ProgressLimit>=10000} { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id [$Database cpp_database_id] \ .file [$Database cpp_database_path] \ .limit $ProgressLimit \ .operation "Populating primary postings index." \ .status "Populating primary postings index of account $RootName." \ ]; ::qw::finally [::list ::itcl::delete object $Progress]; } ::set SrcIfsFile [$Database cpp_file_factory]; ::qw::finally [::list $SrcIfsFile cpp_destroy]; ::set RootFile [$Database cpp_file_factory]; ::qw::finally [::list $RootFile cpp_destroy]; $RootFile cpp_file_open \ .path "/odb/index$RootClassPath.postings.index/id" \ .range.begin [::list string $RootObjectId] \ .range.end [::list string $RootObjectId] \ ; ::set ProgressAccumulator 0; ::foreach Account $AccountList { # ------------------------------------------------------------ # Copy records from enabled accounts below. # ------------------------------------------------------------ ::set OS [$Database cpp_object_structure_load .address $Account]; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.postings.index/id"; $SrcIfsFile cpp_file_open \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::for {::set Before [$SrcIfsFile cpp_record_first]} {[::sargs::size $Before]!=0} {::set Before [$SrcIfsFile cpp_record_next $Before]} { # ------------------------------------------------------------ # Copy records from one account's .postings.index/id index. # ------------------------------------------------------------ ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=119} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set After $Before; ::set KeyList [::sargs::get $Before .key]; ::lset KeyList 1 $RootObjectId; ::sargs::var::set After .key $KeyList; $RootFile cpp_record_insert .after $After; } } ::if {$Progress ne ""} { ::if {$ProgressAccumulator!=0} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } } ::proc ::qw::odb::active_index::collection_enable_populate_transactions_index_id {sargs} { /* { When JOURNAL.transactions becomes enabled, this method populates JOURNAL.transactions.index/id from cross-section of enabled descendents below. */ } ::if {!$::qw::control(active_index_is_enabled)} { ::qw::bug 314120241119104219 "[::qw::methodname] - invalid method call."; } ::set RootJournal [::sargs::get $sargs .root_journal]; ::set Command [::sargs::get $sargs .command]; ::set Journal [::sargs::get $sargs .journal]; ::if {$Journal eq ""} { ::set Journal $RootJournal; } ::set Database [::sargs::get $sargs .database]; ::if {$Command eq ""} { ::set JournalList [[::qw::procname] $sargs .command "get_enabled_journal_list"]; } ::if {$Command eq "get_enabled_journal_list"} { ::set OS [$Database cpp_object_structure_load .address $Journal]; ::set IsEnabled [::sargs::boolean_get $OS .data.transactions_collection_is_enabled]; ::if {$IsEnabled} { ::if {$Journal eq $RootJournal} { ::qw::bug 314120241119170550 "[::qw::procname] - root collection should not be enabled."; } ::return [::list $Journal]; } ::set JournalList [::list]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.odb_deriveds.index/id"; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set IfsFile [$Database cpp_file_factory]; ::qw::finally [::list $IfsFile cpp_destroy]; $IfsFile cpp_file_open \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::for {::set Record [$IfsFile cpp_record_first]} {[::sargs::size $Record]!=0} {::set Record [$IfsFile cpp_record_next $Record]} { ::set Kid [::lindex [::sargs::get $Record .key] end]; ::set KidJournalList [[::qw::procname] $sargs .journal $Kid]; ::set JournalList [::concat $JournalList $KidJournalList]; } ::return $JournalList; } /* { At this point we have the list of enabled journals from below. Note that this is not particularly scalable but simpler to manage a progress box when not implemented recursively. */ } ::set RecordCount 0; ::foreach Journal $JournalList { # ------------------------------------------------------------ # Get the total count of records to be copied. # ------------------------------------------------------------ ::set OS [$Database cpp_object_structure_load .address $Journal]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.transactions.index/id"; ::set ObjectId [::sargs::get $OS .system.object_id]; ::incr RecordCount [$Database cpp_file_record_count \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ]; } ::set RootJournalOS [$Database cpp_object_structure_load .address $RootJournal]; ::set RootClassPath [::sargs::get $RootJournalOS .system.class_path]; ::set RootObjectId [::sargs::get $RootJournalOS .system.object_id]; ::set RootName [::sargs::get $RootJournalOS .data.name]; ::set ProgressLimit $RecordCount; ::set Progress ""; ::if {$ProgressLimit>=10000} { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id [$Database cpp_database_id] \ .file [$Database cpp_database_path] \ .limit $ProgressLimit \ .operation "Populating primary transactions index." \ .status "Populating primary transactions index of journal $RootName." \ ]; ::qw::finally [::list ::itcl::delete object $Progress]; } ::set SrcIfsFile [$Database cpp_file_factory]; ::qw::finally [::list $SrcIfsFile cpp_destroy]; ::set RootFile [$Database cpp_file_factory]; ::qw::finally [::list $RootFile cpp_destroy]; $RootFile cpp_file_open \ .path "/odb/index$RootClassPath.transactions.index/id" \ .range.begin [::list string $RootObjectId] \ .range.end [::list string $RootObjectId] \ ; ::set ProgressAccumulator 0; ::foreach Journal $JournalList { # ------------------------------------------------------------ # Copy records from enabled journals below. # ------------------------------------------------------------ ::set OS [$Database cpp_object_structure_load .address $Journal]; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set IfsFilePath "/odb/index$ClassPath.transactions.index/id"; $SrcIfsFile cpp_file_open \ .path $IfsFilePath \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::for {::set Before [$SrcIfsFile cpp_record_first]} {[::sargs::size $Before]!=0} {::set Before [$SrcIfsFile cpp_record_next $Before]} { # ------------------------------------------------------------ # Copy records from one journal's .transactions.index/id index. # ------------------------------------------------------------ ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=119} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set After $Before; ::set KeyList [::sargs::get $Before .key]; ::lset KeyList 1 $RootObjectId; ::sargs::var::set After .key $KeyList; $RootFile cpp_record_insert .after $After; } } ::if {$Progress ne ""} { ::if {$ProgressAccumulator!=0} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } } ::proc ::qw::odb::active_index::populate_odb_deriveds_index_id_closure {sargs} { /* { Active_index added NEWVIEW.odb_deriveds.index/id_closure. When we added it, we left it empty and inactive. At some point it may become active and we have to populate by gathering up records from below. When .index/id_closure becomes active, this method populates it from a cross-section of enabled descendents below. When traversing below, if .index/id_closure is active, we copy it and dive no furthur. Otherwise we copy .odb_deriveds.index/id records and then dive down on .odb_deriveds.index/id. -------------------------------------------------------------------------- This works in general but currently only applies to ACCOUNT.postings and JOURNAL.transactions. When the collection is disabled, all indexes including .index/id are inactive. When the collection becomes enabled, we populate the .index/id index by recursively gathering the records from below, .odb_deriveds.index/id for .transactions, or .total.kids.index/id for .postings. We only dive down until we hit an enabled collection. Whenever we visit an enabled collection we copy it's ,index/id index to the root. We dive no further under an enabled collection. Note: We are using a switch in the base method instead of using overriding methods in JOURNAL.transactions and ACCOUNT.postings. This is bad programming but keeps everything in one place. Note: This is implemented in high-level code so we can't use low-level code to enable a collection. It would actually be very easy to move this method ro a low-level proc. */ } ::if {!$::qw::control(active_index_is_enabled)} { ::qw::bug 314120241206151501 "[::qw::procname] - invalid method call."; } ::set RootObject [::sargs::get $sargs .root_object]; ::if {$RootObject eq ""} { ::qw::bug 314120241207121955 "[::qw::procname] - no root object argument."; } ::set Command [::sargs::get $sargs .command]; ::set Object [::sargs::get $sargs .object]; ::if {$Object eq ""} { ::set Object $RootObject; } ::set Database [::sargs::get $sargs .database]; ::if {$Command eq ""} { ::set RecordCount [[::qw::procname] $sargs .object $this .command "record_count"]; ::set ProgressMinimum 1000; ::set ProgressLimit $RecordCount; ::set Progress ""; ::if {$ProgressLimit>=$ProgressMinimum} { ::set Progress [::QW::PROGRESS::OPERATION [::qw::progress::auto] \ .database_id [$Database cpp_database_id] \ .database_path [$Database cpp_database_path] \ .limit $ProgressLimit \ .operation "Populating .odb_deriveds.index/id_closure" \ .state "working" \ .status "[$Database cpp_database_path] populating .odb_deriveds.index/id_closure" \ .destroy_skip 0 \ ]; ::qw::finally [::list ::itcl::delete object $Progress]; } ::set OS [$Database cpp_object_structure_load .address $Object]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set IfsFile [$Database cpp_file_factory]; ::qw::finally [::list $IfsFile cpp_destroy]; $IfsFile cpp_file_open \ .path "/odb/index$ClassPath.odb_deriveds.index/id_closure" \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::set ProgressAccumulator 0; ::set ProgressAccumulator [[::qw::procname] $sargs \ .command "populate" \ .object $this \ .progress $Progress \ .progress_accumulator $ProgressAccumulator \ .root_file $IfsFile \ ]; ::if {$Progress ne ""} { ::if {$ProgressAccumulator!=0} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::return; } ::if {$Command eq "record_count"} { /* { get_active_object_list makes the method recursive. We gather up a cross-section of objects below whose id_closure index is active. These are the ones whose records we will copy to the root object. The root object is the object whose .index/id_closure we are populating. We are going to have to add root id index to id_closure. */ } ::set OS [$Database cpp_object_structure_load .address $Object]; ::set ClassPath [::sargs::get $OS .system.class_path]; # ::set IfsFilePath "/odb/index$ClassPath.odb_deriveds.index/id_closure"; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set IfsFile [$Database cpp_file_factory]; ::qw::finally [::list $IfsFile cpp_destroy]; $IfsFile cpp_file_open \ .path "/odb/index$ClassPath.odb_deriveds.index/id_closure" \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::set IsActive [$Database cpp_active_index_is_active .file $IfsFile]; ::if {$IsActive} { ::if {$Object eq $RootObject} { ::qw::bug 314120241206151955 "[::qw::procname] - root collection should not be active."; } ::set RecordCount [$IfsFile cpp_record_count]; ::return $RecordCount; } # ------------------------------------------------------------ # Get record count from objects below. # ------------------------------------------------------------ /* { This object's id_closure is not active. Add the .index/id record_count and process the objects below. */ } $IfsFile cpp_file_open \ .path "/odb/index$ClassPath.odb_deriveds.index/id" \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::incr RecordCount [$IfsFile cpp_record_count]; ::for {::set Record [$IfsFile cpp_record_first]} {[::sargs::size $Record]!=0} {::set Record [$IfsFile cpp_record_next $Record];} { ::set Kid [::lindex [::sargs::get $Record .key] end]; ::incr RecordCount [[::qw::procname] $sargs .object $Kid]; } ::return $RecordCount; } ::if {$Command eq "populate"} { ::set RootFile [::sargs::get $sargs .root_file]; ::set Progress [::sargs::get $sargs .progress]; ::set ProgressAccumulator [::sargs::get $sargs .progress_accumulator]; ::set OS [$Database cpp_object_structure_load .address $Object]; ::set ClassPath [::sargs::get $OS .system.class_path]; ::set ObjectId [::sargs::get $OS .system.object_id]; ::set IfsFile [$Database cpp_file_factory]; ::qw::finally [::list $IfsFile cpp_destroy]; $IfsFile cpp_file_open \ .path "/odb/index$ClassPath.odb_deriveds.index/id_closure" \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::set IsActive [$Database cpp_active_index_is_active .file $IfsFile]; ::if {$IsActive} { ::if {$Object eq $RootObject} { ::qw::bug 314120241207122824 "[::qw::procname] - root collection should not be active."; } ::for {::set SrcRecord [$IfsFile cpp_record_first]} {[::sargs::size $SrcRecord]!=0} {::set SrcRecord [$IfsFile cpp_record_next $SrcRecord];} { ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=19} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set KeyList [::sargs::get $SrcRecord .key]; ::lset KeyList 1 $ObjectId; ::set DstRecord $SrcRecord; ::sargs::var::set DstRecord .key $KeyList; $RootFile cpp_record_insert .after $DstRecord; } ::return $ProgressAccumulator; } $IfsFile cpp_file_open \ .path "/odb/index$ClassPath.odb_deriveds.index/id" \ .range.begin [::list string $ObjectId] \ .range.end [::list string $ObjectId] \ ; ::for {::set SrcRecord [$IfsFile cpp_record_first]} {[::sargs::size $SrcRecord]!=0} {::set SrcRecord [$IfsFile cpp_record_next $SrcRecord];} { ::if {$Progress ne ""} { ::incr ProgressAccumulator 1; ::if {$ProgressAccumulator>=19} { $Progress increment $ProgressAccumulator; ::set ProgressAccumulator 0; } } ::set KeyList [::sargs::get $SrcRecord .key]; ::lset KeyList 1 $ObjectId; ::set DstRecord $SrcRecord; ::sargs::var::set DstRecord .key $KeyList; $RootFile cpp_record_insert .after $DstRecord; ::set Kid [::lindex $KeyList end]; ::set ProgressAccumulator [[::qw::procname] $sargs .object $Kid]; } ::return $ProgressAccumutlator; } ::qw::bug "34120241207122606" "[::qw::proname] - invalid command \"$Command\"."; }