Grabbing and entering checkbox choices in a list

I received a great deal of help with this project and am trying to put an idea into practice.

This is a Gig management solution. The portal in this layout contains a song ID (which pulls the song title from a catalog), the set and slot number (for the place in the performance for that song). The tough part if when I want to assign the singer to that song's performance. This was previously hard coded, but evolution requires I now mix and match singers and songs. In order to run totals by singer for a given Gig, I need singer names to be inserted in the Roster field in gigs_PERFORMANCES.

I have a layout that contains a dynamic list of singers which checkboxes from a table of singers. My goal is to script the selection of singer(s) and include their names in the roster for that performance.

From a data entry perspective, I choose the song, set and slot on the portal record, which automatically enters that data in the gigs_PERFORMANCES table. What I need the script to do is acknowledge the GigID, SongID, Set and Slot numbers already entered, and then insert the names of selected singers into the Roster field in that same portal record.

Where I'm stuck is the actual mechanics of first establishing the data entered into the portal record (GigID, SongID, Set/Slot, etc.) in the script, then acknowledging which checkboxes (singers) are selected, and then assigning the singer(s) names to a variable in the script to post that info in the Roster field.

I imagine either a Loop or Case would be used, but so far, all I've done is insert commas into the Roster field.

Thoughts? Suggestions appreciated!!!

On the Gigs layout, the portal is gigs_PERFORMANCES. The circled button opens the layout "Choose Singer" in a card. If I click the button to add a singer (blue arrow) in this case, Song 096, Set 3, Slot 3, for example, the card comes up with my singer list, but the Song, Set and Slot are the first portal record (see further down).

The "Choose Singer" Card has a script trigger to run the "Choose Singer" script. I added the GigID, Set/Slot and SongID fields to the card for testing. Currently the GigID is correct, but the SongID and Set/Slot are the same regardless on which portal record I invoke the card. (obviously something's not right there).

Set/slot and SingID can be passed as parameters when opening the singer selection card and be stored in global variables. The content of the latter can be retrieved when the selection of a singer triggers aselection-handling script.

3 Likes

In principle, I get it. In practice, I'm failing. Right now, I'm just trying to establish that the correct field contents are being passed as global variables. This is what I have in my script. It is invoked when I click the Add Singer button.
image

When the card comes up, this is what is being shown (Global variables on the left; records from gigs_PERFORMANCES on the right). I get this when clicking in the portal row for the last song which should be SongID 034, Set/Slot 2/2, PerformanceNo 876.
image
I'm not even getting to how to take checkboxes from the card and transfer the name(s) to the portal record, field Roster...

What am I missing?

Hi @cpking

Above you showed an excerpt from the script. Could we see the full script, so that we can see the context that the Set Variables steps happen in? In particular, I am curious to know whether those steps are happening before or after your script opens the new window.

EDIT: Seeing the full script will also tell us what context of layout you are opening up in the card window.

Also, a +1 to what @Torsten said: The values from the portal row can be passed in as part of a script parameter.

Very best,

-Steve

1 Like

At this point there's not much to look at. I'm just trying to pass the current portal row info (SongID, Set, Slot, PerformanceNo and GigID) to global variable


My thinking was to get that far, then tackle the actual singer selection

Thanks @cpking .

Next questions:

  1. This script is attached to the button on the portal row?

  2. And, if so, when you use the Script Debugger to step through the action of clicking on that button in the portal row, and the Data Viewer to see the current values in the script, are you seeing unexpected values being set into the variables in lines 7 through 8 ?

  3. If the script is not set up to be the action of the button on the portal row, could you please say a little bit more about what is hooked up to the button ? Have you hooked things up so that the button action is a single script step which opens up a new window ? If so, while not impossible to work with, I think you'd be better off hooking up a script which takes on both the task of storing the context in variables, and the task of opening the window. I was thinking that you were already doing this, but I am not certain, and hope to clarify.

Thanks, Clayton.

1 Like

Yes, the script it attached to a button that appear in the portal row.

No matter what row I click on (or changing to a different gig), I get the same data.

My goal is simply to assign one or more singers to a given portal record (song/performance). Before I even attempted to deal with checkboxes and singer names, I was looking for the best method of ensuring that a singer is attached to the correct portal record. Thus, my attempt at passing portal field data to global variables.

The card being called is a layout using gigs_PERFORMANCES. So my first goal was to establish the GigID, SondID, Set/Slot and PerformanceNo of the portal row and pass it to the card. That's where I'm currently stuck.

My next goal is to assign one or more singers and, upon closing the card.

No matter what record I click the button to invoke the script, this shows in the data viewier.
image

Interesting development... Using the same script and following it in debugger, it runs, but the global variables are no longer being set (even incorrectly). The data viewer is empty...

Good job in stepping through the script to see what happens. Doing more of that will probably show you where one of your expectations is being challenged.

Have you tried using the Data Viewer to watch the values for the fields that you are referencing from gigs_PERFORMANCES ?

I am surprised to hear that there are no values showing up for those fields under the Current tab of the Data viewer.

When I ran it again, the populated (incorrectly) again. I don't understand what's wrong with this. I thought that if the script was called from a specific portal row, that row's data would be used.

When you ran it again did you keep an eye on the Data Viewer each step of the way?

Yeah. Initially it listed both global and table fields. Then the table fields disappeared and left the (incorrect) globals.

At what point did the field values disappear from the Data Viewer?

Did anything happen that could cause you to leave the context of the clicked portal row?

Also, as you can see below, the layout (Choose Singer) in the card is "seeing" the data on the top right (Gigid=109, SongID=132, setSLOT 1|01, PerformanceNo 840). It's looking at THAT record in the gigs_PERFORMANCES table.

The Globals are being set to GigID=115, SongID=023, Set|Slot 1|1 and PerformanceNo865).

The portal record I'm working with is in Gig 115, SongID=196, Set|Slot=3|2 and PerformanceNo=872)
image

Initially I closed the file down because there was an erroneously named global variable from when I first started working on this. Since I corrected the variable name, nothing replaced it. When I reopened it, the fields were blank (correctly so). When I ran the script the first time, they remained blank; the second time they populated - all this in data viewer.

I don't think the context could have changed... I'm in the Gigs layout, click on a portal row, the card opens (with incorrect data shown) and I close it.

A long shot, are the wrong numbers coming from the 1st row in the portal ?

1 Like

Generally speaking, yes. At least that was the case. All but one number (SongID) is the first row data.

Then you are not specifically reading data from the portal row where the button was pressed. You need your script to find the portal row of the pressed button and then gather data form that portal row.

3 Likes

You may need 2 scripts.

  • one that calls the performer selection card AND stores the information from the selected song portal line in global fields or global variables

and

  • one that processes the performer selection and pulls song information from the above mentioned global fields or variables.

Apparently magic still exists in the world! I left the file open last night when I left for rehearsal. On a whim, I ran the script from the Scripts menu rather than invoking it from the button and it worked exactly as I expected it to (i.e., gathering the portal data in global variables). I have no understanding whatsoever of why this is the case. I even closed down FM and restarted to test. Absolutely NO clue! I'll have to post this on the forum... I included the global variables on the card just to be able to verify that the right into was being used...

Here's the script so far:

And when invoked, produces the desired result thus far (i.e., grabbing the correct portal data and pushing it to the global variables):

image