AreaList Pro Code Sample

Controls user interface on a click list supporting
User categorization of Medicare Policy Document
International Category of Disease Codes and/or code ranges by
Click, Drag, and Swipe under option key control. Screen Shot

The User clicks on a code with modifyer key
The code and any associated codes/ranges are categorized,
colored appropriately, and moved to the bottom of the list.

The next code is located in the list is selected automatically,
located in the document, and presented for the next decision
----------------

AreaList Decision Support
by Daniel Pride
----------------

Case of
: (Form event=On Load )
ARRAY INTEGER(aSelection;0)
ARRAY LONGINT(aCovered;0)
ARRAY LONGINT(aPolicy_ICD9_ID;0)
C_BOOLEAN($Modified)
ThePolicyID:=[Policy]Policy_ID
$Status:=[Policy]Status
If ($Status<3)
ORDER BY([Policy_ICD9];[Policy_ICD9]Covered;>;[Policy_ICD9]Policy_ICD9_ID;>)
Else
ORDER BY([Policy_ICD9];[Policy_ICD9]Covered;>;[Policy_ICD9]ICD9_ID;>)
End if
SELECTION TO ARRAY([Policy_ICD9]Policy_ICD9_ID;aPI_ID;[Policy_ICD9]Covered;aCovered;[Policy_ICD9]ICD9Code;aICD9;[Policy_ICD9]ICD9Description;aICD9Description;[Policy_ICD9]Range;aICD9Range)
$Count:=Size of array(aCovered)
zaba:=AL_SetArraysNam (vALPICD9;1;5;"aICD9";"aICD9Description";"aPI_ID";"aCovered";"aICD9Range")
For ($i;1;$Count)
Case of
: (aCovered{$i}=1)
AL_SetRowColor (vALPICD9;$i;"Blue";0;"White";0)
: (aCovered{$i}=2)
AL_SetRowColor (vALPICD9;$i;"Red";0;"White";0)
: (aCovered{$i}=3)
AL_SetRowColor (vALPICD9;$i;"Black";0;"White";0)
: (aCovered{$i}=4)
AL_SetRowColor (vALPICD9;$i;"Gray";0;"White";0)
End case
End for
AL_SetHeaders (vALPICD9;1;2;"ICD9";"Description")
AL_SetRowOpts (vALPICD9;1;1;0;0;1;0)
AL_SetWidths (vALPICD9;1;2;50;300)
AL_SetColOpts (vALPICD9;0;0;0;2;0;0;0)
AL_SetHdrStyle (vALPICD9;0;"Geneva";9;0)
AL_SetMiscOpts (vALPICD9;1;0;"/";0;1)
AL_SetScroll (vALPICD9;-2;-3)
AL_UpdateArrays (vALPICD9;-2)
Result:=AL_GetSelect (vALPICD9;aSelection)

: (Form event=On Plug in Area )
$Modified:=True
If (<>Machine="Mac")
$Option:=Macintosh option down
$Control:=Macintosh control down
$Command:=Macintosh command down
Else
$Option:=Windows Alt down
$Control:=Caps lock down
$Command:=Windows Ctrl down
End if
$Shift:=Shift down
If (ALProEvt=1)  `-----------------------------Single Click
Result:=AL_GetSelect (vALPICD9;aSelection)
SelectCount:=Size of array(aSelection)
RecCount:=Records in selection([Policy_ICD9])
$TheSelectNum:=aSelection{1}
TheICD9Range:=aICD9Range{$TheSelectNum}
TheICD9:=aICD9{$TheSelectNum}
ThePolicyICD9ID:=aPI_ID{$TheSelectNum}
FindIT:=TheICD9
Case of
: ((SelectCount=1) & ($Command=False) & ($Option=False) & ($Control=False))  `------Single item No Modifiers
$Modified:=False
FindIt:=TheICD9
If ($Shift)
$RangeLength:=0
Else
$RangeLength:=Length(TheICD9Range)
End if
If ($RangeLength>0)
$TheRangeDash:=Position("-";TheICD9Range)
FindIT:=Substring(TheICD9Range;($TheRangeDash+1))
TheLength:=Length(FindIT)
FindOnePlace (FindIT)
Else
TheLength:=Length(FindIt)
FindOnePlace (FindIT)
End if

: (SelectCount=1)  `-----------------Single Item with modifiers
$Modified:=True
If ($Shift)
$RangeLength:=0
Else
$RangeLength:=Length(TheICD9Range)
End if
If ($RangeLength>0)  `--------------Single Item With a Range
CREATE SET([Policy_ICD9];"ICD9Set")
SET QUERY DESTINATION(Into set ;"RangeSet")
QUERY([Policy_ICD9];[Policy_ICD9]Range=TheICD9Range)
INTERSECTION("ICD9Set";"RangeSet";"RangeSet")
SET QUERY DESTINATION(Into set ;"CovSet")
QUERY([Policy_ICD9];[Policy_ICD9]Covered=1)
INTERSECTION("CovSet";"RangeSet";"RangeSet")
SET QUERY DESTINATION(Into current selection )
USE SET("RangeSet")
SelectCount:=Records in selection([Policy_ICD9])
FIRST RECORD([Policy_ICD9])
For ($S;1;SelectCount)
Case of
: ($Control & $Option)
[Policy_ICD9]Covered:=1
SAVE RECORD([Policy_ICD9])
: ($Option)
[Policy_ICD9]Covered:=2
SAVE RECORD([Policy_ICD9])
: ($Control)
[Policy_ICD9]Covered:=3
SAVE RECORD([Policy_ICD9])
: ($Command)
[Policy_ICD9]Covered:=4
SAVE RECORD([Policy_ICD9])
End case
NEXT RECORD([Policy_ICD9])
End for
USE SET("ICD9Set")
Else   `--------------------Single Item No Range
$Modified:=True
For ($S;1;SelectCount)
$TheSelectNum:=aSelection{$S}
GOTO SELECTED RECORD([Policy_ICD9];$TheSelectNum)
Case of
: ($Control & $Option)
[Policy_ICD9]Covered:=1
SAVE RECORD([Policy_ICD9])
: ($Option)
[Policy_ICD9]Covered:=2
SAVE RECORD([Policy_ICD9])
: ($Control)
[Policy_ICD9]Covered:=3
SAVE RECORD([Policy_ICD9])
: ($Command)
[Policy_ICD9]Covered:=4
SAVE RECORD([Policy_ICD9])
End case
End for
End if   `RangeLengthTest

: (SelectCount>1)  `----------------------Multiple Items
$Modified:=True
For ($S;1;SelectCount)
$TheSelectNum:=aSelection{$S}
GOTO SELECTED RECORD([Policy_ICD9];$TheSelectNum)
Case of
: ($Control & $Option)
[Policy_ICD9]Covered:=1
SAVE RECORD([Policy_ICD9])
: ($Option)
[Policy_ICD9]Covered:=2
SAVE RECORD([Policy_ICD9])
: ($Control)
[Policy_ICD9]Covered:=3
SAVE RECORD([Policy_ICD9])
: ($Command)
[Policy_ICD9]Covered:=4
SAVE RECORD([Policy_ICD9])
End case
End for
End case   `SelectCount
End if   `Event is click
AL_RemoveArrays (vALPICD9;1;5)
$Status:=[Policy]Status
If ($Status<3)
ORDER BY([Policy_ICD9];[Policy_ICD9]Covered;>;[Policy_ICD9]Policy_ICD9_ID;>)
Else
ORDER BY([Policy_ICD9];[Policy_ICD9]Covered;>;[Policy_ICD9]ICD9_ID;>)
End if
SELECTION TO ARRAY([Policy_ICD9]Policy_ICD9_ID;aPI_ID;[Policy_ICD9]Covered;aCovered;[Policy_ICD9]ICD9Code;aICD9;[Policy_ICD9]ICD9Description;aICD9Description;[Policy_ICD9]Range;aICD9Range)
$Count:=Size of array(aCovered)
zaba:=AL_SetArraysNam (vALPICD9;1;5;"aICD9";"aICD9Description";"aPI_ID";"aCovered";"aICD9Range")
For ($i;1;$Count)
Case of
: (aCovered{$i}=1)
AL_SetRowColor (vALPICD9;$i;"Blue";0;"White";0)
: (aCovered{$i}=2)
AL_SetRowColor (vALPICD9;$i;"Red";0;"White";0)
: (aCovered{$i}=3)
AL_SetRowColor (vALPICD9;$i;"Black";0;"White";0)
: (aCovered{$i}=4)
AL_SetRowColor (vALPICD9;$i;"Gray";0;"White";0)
End case
End for
AL_SetHeaders (vALPICD9;1;2;"ICD9";"Description")
AL_SetRowOpts (vALPICD9;1;1;0;0;1;0)
AL_SetWidths (vALPICD9;1;2;50;300)
AL_SetColOpts (vALPICD9;0;0;0;2;0;0;0)
AL_SetHdrStyle (vALPICD9;0;"Geneva";9;0)
AL_SetScroll (vALPICD9;-2;-3)
AL_UpdateArrays (vALPICD9;-2)
  `--------------------------------------------Find next item
If ($Modified)
TheICD9Range:=aICD9Range{1}
If ($Shift)
$RangeLength:=0
Else
$RangeLength:=Length(TheICD9Range)
End if
If ($RangeLength>0)
$TheRangeDash:=Position("-";TheICD9Range)
FindIt:=Substring(TheICD9Range;($TheRangeDash+1))
TheLength:=Length(FindIt)
Else
FindIt:=aICD9{$TheSelectNum}  `Changed from 1
TheICD9:=aICD9{$TheSelectNum}
TheLength:=Length(FindIt)
End if
FindOnePlace (FindIt)
End if
ARRAY LONGINT(aPlaces;0)
ARRAY LONGINT(aPlacesID;0)
AL_UpdateArrays (vALPPlaces;-2)
REDRAW(vALPPlaces)

: (Form event=On Data Change )
AL_UpdateArrays (vALPICD9;-2)
REDRAW(vALPCPT)
End case