Easiest Yes/No checkbox field for use on data sheet


#1

What the easiest-to-use implementation of a Yes/No or checkbox field in Panorama X?

One of the easiest-to-appreciate features of Panorama X is the breadth and power of the workbench it provides the data crafter. In this case, I’m having trouble building a simple-to-use field for a yes/no checkbox. The best I’ve been able to do so far is a text field with “Choices” set to “Yes No” (defaulting to one or the other). In use in a data sheet, I can {tab} into the field, type “y” or “n”, and tab out, or double-click the field, click one of the radio buttons, and click elsewhere.

I would like to be able to toggle the value in the field with a single click of the data sheet.

If, by chance, a checkbox were visible in the data sheet, the status shown by a checkbox is much more readily perceived at a glance than from a long list of short words.

Thanks.


#2

I’ve thought of doing something like that as a future feature, but so far it hasn’t made it to the top of the list.

In a situation like that I’ll usually use either a single character (like x or ) or empty. If I need to mark a bunch of them I’ll click on a cell that already has the character, then paste that into the other records I want to select. Not quite as easy as a simple click, but easier than typing since no return or enter key is needed.


#3

My suggestion would be to create a .CurrentRecord automatic procedure with some simple code that checks to see if the newly clicked record is in the field you are using to flag the records and then either mark it checked or clear the check mark if it is already checked. In my test I have a text field named “check” and my .CurrentRecord procedure has this code:

If info("fieldname")="check" & 
    If info("modifiers") contains "option"
        formulafill ""
        stop
    endif
If chec
    If check=""
    	check="√"
    else
    	check=""
    endif
Endif

This will put a check mark in the check field if it is clicked in a record that has just been made current or blank it if there was already a check mark there. If the field is clicked with the option key down it will remove all the check marks from the field. The video below shows this in action with the final click being an option-click to clear the entire field of check marks.

CheckBox


#4

This looks both fantastic and spot-on, and serves as a eye-opener re: using Panorama X to do what I want instead of relying solely on the in-built procedures.

But the code shows as “Syntax error” when I paste it into the Procedure editor, and no amount of fiddling I’ve done resolves the error. It looks (to me) that something got lost from line #6, “If chec”. I tried a few things but none work. Could you confirm that what you pasted matches the code you used in your example?


#5

Yep, in my copy/paste routine I must have inadvertently truncated that line of code. Here is what it should be:

If info("fieldname")="check"
    If info("modifiers") contains "option"
        formulafill ""
        stop
    endif
    If check=""
    	check="√"
    else
    	check=""
    endif
Endif

#6

And Kirby, you could use your new Toggle process to quickly select records manually.


#7

Yes :blush: . They are joined in my plans. I posted them as separate topics to follow proper forum protocol.


#8

Thanks much! That works very well.

It’s very exciting to be getting started with Panorama X. Thanks to all for the hands-up.

(Added:)

“{Option}-click” to clear all is a nice touch. Thanks for including it.

—Kirby.


#9

This is a very idea Gary.

However, the .CurrentRecord procedure wasn’t really designed for this sort of application. Because of that, there are some problems with this. First of all, it only works if you click on a different record than the current record. If you keep clicking on the same record, nothing happens, because .CurrentRecord is only triggered when the record changes.

Also, the .CurrentRecord procedure is triggered by events other than mouse clicks. Try clicking on the check field, then use the down arrow key (or up arrow). You’ll see the checkmarks toggle as you go down to each record. Also, performing an operation like Find (or Find Next) will toggle the checkmark.

I’m not saying this isn’t useful as-is, it certainly could be, just thought I’d point out the quirks before someone else discovers them. To make a non-quirky version of this would require that Panorama have a procedure that is automatically triggered when clicking on a data cell. Right now there is no such procedure. There are some potential pitfalls of such a procedure, so I’ll have to ponder that.


#10

Let’s face it, half of what I come up with is using things that are “not designed” for for that particular purpose. But often that is the only way to accomplish some currently unsupported tasks - if even partially. I know this suggestion has some drawbacks as you pointed out but I still think it will be useful in Kirby’s case nonetheless.


#11

Very much so. I don’t read Jim’s comment as in any way censorious — just completing the picture, which I had already limned, but which was still useful to me and will be useful for anyone coming along. I don’t have time to comment further right now (I was planning to post some hints on use); for the time being let me say once again: thanks to each of you, whose input I find helpful and exemplary.


#12

I often compare Panorama to a saw. The manufacturer thinks it’s a tool for cutting wood but some people use it as a musical instrument. There are always other ways to apply Panorama than what was intended and they’re often very useful and successful.

That said, another approach is to create a matrix or a View as List form with a checkbox. The View as List is easy enough to create and can actually provide concise, more informative views of the involved data. Less important fields can be out of the way, yet remain fully involved when necessary.

A keyboard command can be added to check or uncheck the record or a click of the mouse will do it.

Here’s a screenshot of a Pan 6 View as List form doing just that


#13

:+1:. Thanks James. Hop-scotching through the Help docs now.

(Added:) I have read and am heeding this from Help:

In older versions of Panorama, View-As-List forms were the primary way to display scrollable data other than the data sheet. Panorama X now includes two other powerful methods for displaying scrollable data – the Text List Object and the Matrix Object. Unlike View-As-List forms, these objects allow you to combine scrollable data with other form elements in a single window. In most new applications, we recommend using these objects instead of the View-As-List option.

It seems the Panorama 6 “View-As-List” was the form, whereas the new-in-Panorama-X “Matrix Object” is a “View-As-List” object within a form.


#14

Panorama 6 also had a matrix object. It’s capabilities were slightly different. More capable in some ways, less in others.


#15

The Text List works quite well although there’s an outstanding issue on redrawing the active record. I’ve used it exactly as you’re describing for a process I’ve referred to as Tagging records.

The matrix does let you get more involved in the design of how each record is displayed and would be the way to go if you want to include an image or multiple lines per record - more like my screen shot example of the Pan 6 list.


#16

If you have a field named Tag, using the code below, you can right click in the data sheet to Tag or UnTag records. That’s pretty darned close to simply clicking on them.

    filemenubar "",
menu("Context Menu")+
    menuitem("Tag","CODE",{Tag="X"})+
    menuitem("UnTag","CODE",{Tag=""}),
"DATA_CONTEXTMENU"

#17

Be sure to note that there are actually three options here. The matrix is good, but the View as List is far easier to construct and should do well for you.


#18

And there are some of us who use matrices in view-as-list forms!