﻿Parameter nextfocus  // focus when returning from dialog

CreateStructure V[tabfield] tablename fieldname

Set V[tabfield.tablename] "KNA1"
Set V[tabfield.fieldname] "LAND1"
Set V[title] "Select country"
Set V[search_help] "H_T005"

// empty range table? then add first value
if V[range_land1.rowcount=0] 
  
  if V[land1_low]  
    
    Set V[rangeline.sign] "I"
    Set V[rangeline.option] "EQ"
    Set V[rangeline.low] "&V[land1_low]"
    
  endif
  
  // append first selection
  AppendRow V[rangeline] table=V[range_land1]
  
  // indicate: multiple selection active
  Set V[land1_low] "*"
  
endif


Call "COMPLEX_SELECTIONS_DIALOG" -try -dialog _
  export.tab_and_field="tabfield" _
  export.title="title" _
  export.search_help="search_help" _
  export.range(RANGE_C35)="range_land1" _
  import.range(RANGE_C35)="range_land1"


// empty range table? then clear first interval
if V[range_land1.rowcount=0] 
  Clear V[land1_low] 
  Clear V[land1_high]  
endif

// set focus
if U[nextfocus]
  SetCursor "&U[nextfocus]"
endif


return