Question
Eduard Lebedyuk · Nov 24, 2017

Index build order

Is there any way to specify in which order indices are built during:

  • %BuildIndices
  • %Save

So far I think they are built by name order.

 

00
0 0 3 223
Log in or sign up to continue

For %BuildIndices you may provide a list  or use default. it doesn't affect sequence

example from Sample.Person.1.Int

%BuildIndices(pIndexList="",pAutoPurge=1,pLockFlag=0,pJournalFlag=1,pStartID="",pEndID="",pIgnoreIndexList="") public {
if ($listlength(pIndexList)=1)&&($listget(pIndexList,1)="") return 1 }
Set class=$classname(),tBuildFlags=1,tBuildFlags(class)=$c(0,0,0,0,0,0)
Set tPtr=0,tStatus=1,pJournalFlag=''pJournalFlag
While $listnext(pIndexList,tPtr,tIndex) {
continue:tIndex=""
If '$d(^oddCOM(class,"i",tIndex)) {
Set tStatus=$select(+tStatus:$$Error^%apiOBJ(5066,class_"::"_tIndex),1:$$AppendStatus^%occSystem(tStatus,$$Error^%apiOBJ(5066,class_"::"_tIndex)))
}
}
If ('tStatus) RETURN tStatus
if $listfind(pIndexList,"$Person") set $Extract(tBuildFlags(class),1)=$c(1) }
if ((pIndexList="")||($listfind(pIndexList,"FCOL"))),'$listfind(pIgnoreIndexList,"FCOL") set $Extract(tBuildFlags(class),2)=$c(1) }
if ((pIndexList="")||($listfind(pIndexList,"NameIDX"))),'$listfind(pIgnoreIndexList,"NameIDX") set $Extract(tBuildFlags(class),3)=$c(1) }
if ((pIndexList="")||($listfind(pIndexList,"SSNKey"))),'$listfind(pIgnoreIndexList,"SSNKey") set $Extract(tBuildFlags(class),4)=$c(1) }
if ((pIndexList="")||($listfind(pIndexList,"ZipCode"))),'$listfind(pIgnoreIndexList,"ZipCode") set $Extract(tBuildFlags(class),5)=$c(1) }
if ((pIndexList="")||($listfind(pIndexList,"dobx"))),'$listfind(pIgnoreIndexList,"dobx") set $Extract(tBuildFlags(class),6)=$c(1) }
If ((pIndexList="")||($Ascii(tBuildFlags(class),5))) && '$listfind(pIgnoreIndexList,"$Person") set $extract(tBuildFlags(class),1)=$c($select((pStartID'="")||(pEndID'=""):1,1:2)) }
Quit ..%BuildIndexInternal(.pLockFlag,.pAutoPurge,.pStartID,.pEndID,.pIndexList,.tBuildFlags,"^Sample.PersonD",1,.pJournalFlag,0) }
 
 

%Save does it straight by ASSCII sorting of index names (lower after Upper case)

See %SaveData(id)  in the generated .int 

I don't think that order of indices in first argument affects anything. They are converted into tBuildFlags which also follows by ASSCII sorting of index names

I see. It's hard generated
IndexNext distracted me

But you may call it individually. With your sequence then.