Achieving a split data sheet window in Panorama X

One or two users have expressed mortification at the loss of the split data sheet window option that we had in Pan 6.

I’ve written a simple custom procedure which does the job by hiding the intervening fields if anybody would like to have it.

I don’t want to publish it at the moment - its code is very clunky because I’ve had to work around a bug in the fieldnumber( function. When that’s fixed, I’ll post the clean code.

Michael, for what it might be worth here is an alternate scheme to using fieldnumber( although you probably can implement that function using the trick Dave posted on Bitbucket. This iteration however uses the array from visiblefields( to serve as the basis to extract the fields between the start and split field so they can be hidden. Half the code simply consists of traps to stop in case incompatible field names have been entered along with explanatory comments. The variable __startFields will contain all the original visible fields that can be used with showthesefields to regenerate the original datasheet.

fileglobal __startFields
__startFields=visiblefields()
// create and seed variables for gettext statements
local startField,splitField,hideFields,startPos,splitPos
startField=array(__startFields,1,¶)
splitField=array(__startFields,-1,¶)
// get the name of the starting leftmost field with check
gettext "Enter start field…",startField
if array(__startFields,arraysearch(__startFields,startField,1,¶),¶)≠startField
    alertok "Field does not exist!"
    stop
endif
// get the name of the field to move from the right for split view
gettext "Enter split field…",splitField
if array(__startFields,arraysearch(__startFields,splitField,1,¶),¶)≠splitField
    alertok "Field does not exist!"
    stop
endif
// get the position of the start field and split field within __startFields
startPos=arraysearch(__startFields,startField,1,¶)
splitPos=arraysearch(__startFields,splitField,startPos,¶)
// make sure there are fields inbetween to hide
If startPos > (splitPos-2)
    alertok "Can not split between these two fields"
    stop
endif
// get list and hide all the fields between the start and split fields
hideFields=arrayrange(__startFields,startPos+1,splitPos-1,¶)
hidethesefields hideFields```

This is my solution, using the fieldnumber( function:

Local secondField, fieldList, fieldCount

;  Extract parameter and get location of second field

secondField = parameter(1)
fieldCount = FieldNumber("",""+secondField)

;  Test validity of parameter

Case fieldCount = 0
    ReturnError "HIDEINTERVENINGFIELDS: There does not appear to be a field called " +  secondField
Case fieldCount ≤ FieldNumber("","")
    ReturnError "HIDEINTERVENINGFIELDS: The nominated field is not to the right of the currently active field."
EndCase

;  Delete intervening fields

Right
Loop
    StopLoopIf info("FieldName") = secondField
    HideCurrentField
Until stopped

Left

… and this is the ProcedureInfo block (which I forgot):

/*

hides all of the fields that lie between the currently active field and a nominated field which appears later on in the database. It emulates the Panoram 6.0 feature that allows you to split the data sheet screen and bring two widely separated fields into close alignment, a feature that is not available in Panorama X.

<«Tags»>statement,fields,hidden fields</«Tags»>
<«Breadcrumb»>Panorama>Procedures>Fields</«Breadcrumb»>

The nominated field.

New in this version Michael Kellock */

Well, that didn’t go over very well. Try this:

/*

The HIDEINTERVENINGFIELDS statement hides all of the fields that lie between the currently active field and a nominated field which appears later on in the database. It emulates the Panoram 6.0 feature that allows you to split the data sheet screen and bring two widely separated fields into close alignment, a feature that is not available in Panorama X.

<«Tags»>statement,fields,hidden fields</«Tags»>
<«Breadcrumb»>Panorama>Procedures>Fields</«Breadcrumb»>

<parameter NAME=SECONDFIELD TYPE=TEXT>The nominated field.</parameter>

<body></body>

<errors>
    <error message="HIDEINTERVENINGFIELDS: There does not appear to be a field called <fieldname>"></error>
    <error message="HIDEINTERVENINGFIELDS: The nominated field is not to the right of the currently active field."></error>
</errors>
<seealso></seealso>
<history><revision version="1.0" status="No Change">New in this version</revision></history>
<author>Michael Kellock</author>
</PROCEDUREINFO>
*/

Thanks to Michael and Gary for sharing their code.

I tried my own implementations in several variants including a custom dialog with popup menus for the fields, a procedure using the superchoicedialog statement, but then I realized there is a very simple solution already built-in in Panorama X:
showhidefieldsdialog

That’s a good solution Kurt. And you don’t need to program it because it’s triggered by the Field>Hide/Show Fields … menu item.