Moving Multiple Fields to new Location

I have imported several large databases from Filemaker. Each one has multiple fields and some are rather wide. I am trying to re-arrange the fields so that they are in a more useable order. I am having an issue with the grab and drag in that it does not stay where I dropped it. I place the cursor in the file title area, click and hold, then move to where I want the field to be and let go. It just back to where it came from. Am I doing something wrong?

I would also like to be able to select several fields and move them all at once.

Scrolling left and right through the large database is a bit of a pain. Another option that would be even better would be to have a window that shows a list with all the names of the fields, the order they are currently in (from top to bottom) and the little up/down arrows to drag them to whatever location you want. Is there such a thing?

Others have reported this problem, but if you go to Reorder Fields in the Field menu, you’ll find exactly what you’re asking for in your last paragraph. Look up “Rearranging Field Order” in Help.

I must be missing something. My Fields Menu does not have any Reorder option.


Also, the help menu for Rearranging Field Order only shows how to grab and drag. This is what I was referring to in my first paragraph.

What I was meaning in my last paragraph is totally different. I was after a table layout with each field listed vertically. You then drag them around to wherever you want them. The next screenshot shows the Hide/Show dialogue. This is the type of window I was referring to but with rows that can be dragged. I may be able to use this with a bit of playing around?

The Reorder Fields Dialog was added in version 10.2, which is still in Beta. If you’re not in the Beta testing program you’ll have to wait for its final release to use it. However you can read about it in the online version of the Help file.

Kaiviti, while you would have to wait for the release of Pan X 10.2, you maybe can use a tool that Gary Yonaites created as reincarnation for Pan 6’s Design Sheet. Have a look in the Panorama X menu Help > Database Exchange.

Thanks KJM, This looks to be exactly what I was looking for. I haven’t downloaded the database yet, nor have I figured out how I can use it but, looking at the description, this does the thing I was after. I wonder if Jim will be including this in the next release??

Since i wrote them both, I can say positively the implementation in 10.2 beta is almost exactly the same as what you have shown above.

I don’t know if it me or what, but it does not seem to do what it should do. I managed to get it to work once and that was when I was only moving one field. I have many fields to move around and that may be an issue.

Considering you wrote this feature, you may like to include a few feature requests from me?

  • Would it be possible to select multiple fields at the same time to resort them as a group? This would be helpful if there are several fields in the same area and I wanted to move them all to another area. I tried clicking the first field, holding Shift and clicking the last field to select a range. I also tried the Command key to add individual fields to the current selection - neither of these seemed to work.

  • Another request would be for when I am moving a field to an area that is currently off the visible area. At present I can only move it to a location that is visible; I then need to scroll and move again. With many fields, this can become rather tiresome. Normally things like this happen when you move to the edge of the visible are, it automatically scrolls until you pull away from the edge.

BTW, a job well done to all.

The 10.2 beta version includes all the fields even if they are hidden and allows them to be moved as well. After moving the fields the original hidden fields will be re-hidden again. The drop-down form is also extendable to allow a greater number of fields to be included. Selection of multiple fields is not implemented however and I have no intention of trying to implement such a feature. Maybe Jim might want to look into that at some future date.

I think you have encountered a known bug – dragging to rearrange fields doesn’t work correctly when fields are hidden. More specifically, it doesn’t work if you drag across a hidden field (or fields). Currently, the solution is to make all fields visible before trying to rearrange them.

Panorama includes a statement that allows you to move a field in code. In your application I wonder if it might be worth writing a short procedure to rearrange your fields. That might be the fastest technique if you have a lot of fields to move.

I done a fair bit more experimenting. I have no fields hidden. I didn’t even try it with fields hidden. I have also encountered several crashes in my testing. One thing I have noticed that maybe an issue, is that I have to quite Panorama (and in some cases - force quite) to perform the task properly. Maybe there is something being held in memory that is causing some of these issues. Quitting has not resolved the problems though. The dragging to rearrange works once or twice and then stops.

The Design Sheet by Gary has been the saving grace here but it also has some quirks. I found that it works well when only rearranging a few fields. More that 4 and it fails.

May I ask how many fields do you have in your file?

The current count is 36 fields and that is after I deleted several. I have solved my problem by making all the changes in excel first. I then converted the excel file to csv and created a new database from the csv file. Earlier I was also having problems with importing text into the current database. I found it so much easier in the end to do all the adjustments in excel first.

Hi Gary,

Job well done on the Design Sheet. Obviously, at the moment I am only interested in the Fields Re-ordering feature. It has great potential and I am hoping that Jim will take this feature onboard with the next release of PanX.

I can understand that the selection of multiple fields may be a bit of an issue. I am sure that Jim could do this with his eyes closed. Surely there is a feature in Cocoa to produce a dialogue box that can do this. Selecting several fields at once would be a bonus.

I tried Jims’ idea of movefieldsbefore statement and that worked well fo single moves. I was thinking that if there was a dialogue box like yours and all the fields have been placed in order, clicking a button would invoke a procedure to loop through every record, re-arranging them. I am not a programmer but my thinking it that you would set up a loop (if this is possible??). The way I see it working is you go to the last record and assign that to Field B.

Next, move up one record and assign that to Field A. Continue to move up one record at a time and execute the same procedure until you reach the topmost record.

field "Field A"
movefieldbefore "Field B"

Could that be achieved in some way?

Well, thanks for the nice comment. That file was made as a very crude hack to serve in the early iteration of Panorama X and is now pretty much outdated especially when 10.2 is released.

Here is the code I made for reordering the fields and it uses a looparray to send the fields to the end one at a time in the new order desired. I don’t know if you can pull parts of this out to use yourself (depends upon your comfort with the Panorama programming language).

/*
<PROCEDUREINFO>
<description>Allows you to reorder the fields in the datasheet.</description>
<tags>statement,database,fields</tags>
<breadcrumb>Panorama>Procedures>Fields</breadcrumb>
<body>This statement opens a form with a Text List with the current order of the fields in the datasheet and allows you to drag fields to new locations and then moves them in the datasheet.
</body>
<seealso></seealso>
<history><revision version="1.0" status="New">New in this version.</revision></history>
</PROCEDUREINFO>
*/

opensheet
checkdesignlock

global allFields
local hiddenFields, startFields,currentField
allFields=info("fields")
selectedFields=""
hiddenFields=info("hiddenfields")
currentField=info("fieldname")
loop
    rundialog |||
        Form="Reorder Fields"
        sheet=true
        Menus=normal
        Height=488 Width=217
        OkButton=Reorder
    |||
    stoploopif info("trigger")="Dialog.Close"
endloop
if dlgResult="Cancel"
   nop
endif

if dlgResult="Ok"
    noshow
    showallfields
    looparray allFields,cr(),element,item
        field element+""
        movefieldbefore ""
    endloop
    If hiddenFields<>""
        hidethesefields hiddenFields
    endif
    showother «», 99
    endnoshow
endif
undefine allFields
field currentField+""

I can’t find ‘checkdesignlock’ in the help file…

I used this statement because Jim uses it in several of his custom statements involving field manipulations along with the checkstructurelock statement. I don’t know exactly what either one does but I figured it couldn’t hurt to copy the Master. Don’t ask me why I didn’t also include the checkstructurelock statement as well because I don’t have a clue. Neither statement is documented as you found out. :confused:

It looks like I wrote the documentation for the checkdesignlock but never published it. Maybe this happened because this statement wasn’t documented in Panorama 6 either. In any case, the documentation is very short:

This statement checks to see if the field design of the current database is locked. If it is locked, the procedure stops with an error, otherwise it continues.

For example, you can’t rearrange the fields if the database is shared on a server. By putting the checkdesignlock statement at the top of the procedure you get an error right away. Otherwise you wouldn’t get an error until the movefieldbefore statement. Best to catch this error right away.

The checkkstructurelock statement is new in Panorama X. It basically does the same thing, but instead of just returning an error it presents an alert or notification depending on the settings in the Preferences>Client panel.

Now that you’ve brought this to my attention, I’ve added the documentation for these statements, as well as several other obscure internal statements that I discovered will tracking these down.

My knowledge of Panorama is extremely limited at the moment. Still trying to get me head around doing the basics. Learning the more in-depth stuff is way down the track.