Matrix Difficulties

But, Gary, if we never assumed, how would we get through the day?

As Benny Hill pointed out: ASSUME makes an ASS out of U and ME!

And that can be the standard means for updating matrices and lists.

Step by step, create a new matrix in Lists & Matrixes exactly as described under Matrix Constructor in Help. It builds the matrix exactly as shown. Clicking a record in the datasheet does highlight the corresponding record in the matrix. But clicking a record in the matrix does not activate the corresponding record in the data sheet.

The matrix data panel shows the Database option set to ~ and both Pass Thru and Database Navigator are checked and matrixclick is entered in the Procedure panel. Based on Linking the List to the Current Record in Matrix Database Integration, it should be synching both ways at this point.

(At this point, on Mojave, the Matrix panel frequently loses its display entirely; it becomes blank. Closing and re-opening the file corrects it )

Adding info(“Visible”) to the Query in the Matrix Data panel synchs the matrix to the datasheet so that clicking a record in either highlights the same record in the other. It seems that info(“Visible”) should be part of the work that Matrix Constructor does. It should also be documented.

Bug - Unchecking Pass Thru, but leaving Database Navigator checked causes Panorama to crash from a click on the matrix. That isn’t supposed to be an applied combination but it shouldn’t crash.

Now I’m to the matrix issue that I’m actually trying to resolve; adding a checkbox to the matrix.

I can add a checkbox and get it to where a click on any checkbox in the matrix correctly toggles the corresponding record in the database by adding a procedure to the checkbox on the Matrix Frame.

If InStock = “X” InStock = “” Else InStock = “X” EndIf

You’d never know it in the matrix display though because the checkbox doesn’t update until I click on another record. Repeated clicks on a checkbox leave it looking as it did when the record was activated, giving the impression that the checkbox isn’t working at all and no reliable feedback as to its current state.

Still using a new form and matrix in the Lists & Matrixes demo, nothing works to refresh it: ShowFields InStock; matrixredrawclickedcell; ObjectAction “MatrixName”,“redraw”,“all”,…

A new error is introduced by applying:

let lvID = info(“serverrecordid”) find info(“serverrecordid”) = lvID

In this case, the checkbox toggles visually but displays the opposite of the value actually being set and displayed in the datasheet.

If InStock = “X” InStock = “” Else InStock = “X” EndIf
let lvID = info(“serverrecordid”)
find info(“serverrecordid”) = lvID

I’ve tried all sorts of other ways to workaround it but cannot ever get the matrix to match the current value.

Have you tried the code suggested in an older post in place of this to force the update? Since this code uses noshow it does not have any visible effect on the design sheet and only updates a list or matrix.

noshow
if info("bof")
    downrecord
    uprecordName
else
    uprecord
    downrecord
endif
endnoshow
showpage

This is not accurate. What it does do is is set up the matrix so that it shows the same selection as the data sheet.

A regular checkbox won’t work in a matrix, just as you can’t use a Text Editor in a matrix. The only way to use a checkbox in a matrix is to use formula mode. You may be using this mode and not have mentioned it, I’m not sure. But if you aren’t, you need to be, that’s the only way a checkbox can work in a matrix. If you are not familiar with formula mode see the Data Button Object documentation.

Then what is the prescribed method for synching the matrix to the current record in the datasheet? Until I applied info(“visible”) the datasheet was static as I click on records in the matrix. info(“visible”) resolved it.

I had wondered, so I went straight to the documentation:

Matrix Clicking
You can put almost any kind of object in a matrix frame, including buttons, checkboxes, and text editors. However, you’ll find that clicking on any of these objects doesn’t do anything. This is because these objects aren’t actually there – Panorama has created “fake” objects that are displayed within the matrix, but the real object is still down in the frame.

The docs then go on to describe how to pursue it with no further specific mention of checkboxes.

Actually, it’s now working equally well in either Data or Formula Mode by using up record and down record.

If InStock = "X"
	InStock = ""
Else
	InStock = "X"
EndIf
noshow
if info("bof")
    downrecord
    uprecord
else
    uprecord
    downrecord
endif
endnoshow
showpage

Thanks Gary, that DOES work. It’s similar to what I was using some time ago with matrices but had abandoned in favor of the find technique. With the inexplicable behavior of the find, I hadn’t thought of going back to that one.

There is no prescribed method. You may recall back in the 2016 classes I said there was no way to do this. This is a feature that hopefully will be implemented someday, but hasn’t been so far. The techniques discussed on this thread are not the prescribed method for this, they are hacks that were not intended for this operation.

I never claimed the documentation was perfect or completely exhaustive! If Apple can’t manage that (or anywhere close to that), neither can I. There’s no way anyone can do advanced Cocoa programming without StackOverflow.com, and for advanced Panorama programming you need this forum!

However, the documentation is giving you a clue – the objects aren’t clickable. But I’ll agree that that is only a clue and it would be nice if it was spelled out in more detail.