How might I associate a label with a checkbox?

Thank you for spoon-feeding me this information. I swear I will embody it. I don't know if it is a random occurrence of senior moments or just latent attention-deficit disorder but I just didn't see what you are kindly pointing out here for me. Thank you, again, for your patience.

Thanks for the laffter(sic;). I seem to notice that misspelling about twice a week but it hasn't bothered me enough to change it. Now it is in the public domain and someone is probably already racing to trademark "selectrion."

And, yes . . . once you grabbed my ears and direct my gaze to that save_Humidity block, it is all falling into place.

Oh, and BTW, some of my favorite parameters and formulas are, coincidently, named "x." Thanks again. Enjoy your weekend. It is my hope to go silent for awhile and actually embody what has been presented to me.

I regret to inform you that you are not out of the woods yet.

You have three readings coming in from BLE informing your calculations of those 14 or so named values.

But there will be moments when you only have partial data because of the timing.

I glossed over this by returning a 0 from that dictionary if there is no data. That would lead to errors in downstream calculations.

The proper return should be something like '?' or blank text if no data has arrived, and any calculations fed by that data must be guarded by tests of data completion, to go mum gracefully until all the data is available.

1 Like

Here is sample code for you to convert and calculate missing data without error messages:
blocks (1)


"NaN" is short for Not a Number, which encapsulates how you would like to express lack of a number. I chose blank, you could use "Unavailable" or "?", etc.

Finally, here is how to code a multi-parameter formula with garbage filters:

1 Like

Whoa! Thank you so much. I keep forgetting to check in with an existing feed and I do not receive follow-up notifications. I may or may not have experienced that problem but I so appreciate you providing a pre-emptive means of avoiding the issue altogether.

I have been busy embodying what you have presented, especially making the dictionary set-up work for me. I finally figured out how to embed the "get the dictionary listing" from the function or equation to the checkbox display page.

I tried playing and researching but to no avail to accomplish the following things. It's like "50 Ways to Leave Your Lover," in that there are many ways to make some routines happen. Can you help me with two variations of your code, please? I would like to have a "Check All: and an :Uncheck All" button on the checkbox page. I would post something to build on if I had even a modicum of success but I am, once again, swimming over my head.

I guess I do have another request or, at least, a question. Is it possible and, if so, how might I bring up two dictionary listings with one checkbox or place two numbers in a single listing? My idea is that, when the dry bulb temperature box is checked and the data displayed, I can associate both the Celsius and Fahrenheit temperatures adjacent to the "Dry Bulb Temp." display page. This would happen with several temperature displays and many other measurements, as well. If this is not practical or even possible, I can easily modify the data request buttons with "Imperial" or "Metric" buttons. I have those associated with the data entry calculator but those are for input selection.

Thank you for reading through all of this. I sometimes walk away from a posting here with a sense of having seen a psychiatrist or emotional-support counselor. It is a feeling of "I don't know how but everything's going to be fine."

You will need a global init for a variable named something like MyCheckboxes, with a create List block with 14 sockets, one per checkbox (last I looked.)
It's easier to add the sockets while they are unpopulated, so you can squeeze them in at the top, because the bottom of the sockets get pushed offscreen.
Add component blocks for your 14 checkboxes to the sockets. The component blocks are the ones at the end of the blocks pallette for each component, without .Anything
See Wordle In A Day for how I do this with Labels and Buttons.

Once you have your global list of checkboxes, you can traverse it in your Button Click event like

for each checkbox in global MyCheckboxes
set Checkbox.Checked of component checkbox to true

image

Use a generic (All) checkbox block.

Though you could add logic to flip more check boxes in response to another checkbox being flipped, that would make your app an aggravating puzzle.

Button preset collections of checkboxes sounds simpler.

1 Like

Thank you for another dose of knowledge. I will work with this.

Yup, that was my general conclusion. Thank you for seconding it. :slight_smile:

Greetings,

Happy hump day (although I haven't held a desk job in a long while;). I am attaching a file and screenshot. I get this error (screenshot) the first time through an operation. If I click outside of the error box, I can continue. If I uncheck and recheck the Wet Bulb box, the error returns. If I continue by selecting ATMO and then "Get Data," the first time, wet bulb is populated with zero. If I return to the checkbox page and select wet bulb again, the error no longer appears. I am befuddled.

The "logical" idea is that one first selects Imperial or Metric, then checks the boxes requested, then clicks "ATMO" and "Get Data." The idea is a top-down sequencing and I will have background colors turning on and off as buttons and checkboxes become available. I do have a couple of other selections besides ATMO but, for simplicity, I wanted to isolate the errors as much as possible.

My question is "how do I keep the error message from showing on my first round through?" Actually, "how do I eliminate the error" is a much better question. I thought I duplicated your logic in the wet bulb sketch you sent but I guess I am missing something(s). As a follow-up, I get the error in the second screenshot if I try to choose out of sequence (ATMO before Imperial or Metric). Is there a way to eliminate this error message or change it to say "Enter Data From the Top Down"? Or something . . .?

I have been doing due diligence here for the last few days but to not much avail. Can you help straighten out my reasoning? Thank you so much.

July_26_help.aia (3.6 MB)

I gave you preventative code in

to avoid just this error.

But I don't see it in your code.

If I give you more, are you going to go rip it out, or are you going to leave it in?

Here is your code, with all math protected against non-numeric input.

I advise against removing the protection.


July_26_help (1).aia (3.6 MB)

Wow, I thanked you for your code and, somehow, I totally ignored it.
In the future, I welcome just a simple (I explained that "here") reply to protect your sanity. I probably missed that block of code or deleted it through my lack of GUI skills. Half of my forward progress here is the result of an "Oh, gosh, I totally forgot that" moment. Thank you for responding (again) and for your extreme patience with my ADHDish mind. I will report back when I have successfully incorporated your advice into my script.

OK, that works as advertised;). I replaced the "?" with "Please re-enter your data" and there is no longer the appearance of the app querying me (?).

Could we take this a step further and "discuss" (learn me:) what is happening that causes a first-time entry to come up "NaN" but all subsequent requests are populated with the correct calculations? I have tried changing the sequence of my request but to no apparent avail, and I always bring the BLE device online and connected (displaying live data) before I make a request in my checkboxes.
Do I need to load some dummy data somewhere? I am certain this is not an MIT AB2 restriction . . . I think. BTW, once the numbers populate, they are within a very close tolerance to Internet readings. Dry Bulb = 27.55C, Humidity = 44.57%, DP calculated as 14.97C and WB calculated as 19.21C.

I am attaching two screen shots. The first one just calls up NaN with my answer for the wet bulb and a fat zero for the dewpoint. All subsequent data requests are normal and correct. Is this fixable? Thank you for your knowledge as I pack in whatever will stay.

This is an inevitable result of your data arriving out of sync with each other.

It can be handled in several ways:

  • By not doing anything in the way of calculation until you have all (numeric) the data, or
  • By phoning in the calculations when you have incomplete data and returning some kind of Nan asking for patience until the data arrives.
  • By exercising theatrical showmanship in delaying raising the curtain until all the actors (data) are in place.

I favor the third option.

P.S. On further thought, if the actors are unavailable close the theater and stop selling tickets. The app logic equivalent would be to cycle through all the check boxes and disable and turn off those which would trigger calculations using unavailable or stale data.

You can track freshness of your three inputs (t,h,p) by updating parallel variables t_ms, h_ms, p_ms (initially 0) with Clock1.SystemTime in the BLE arrival events, and check them against current SystemTime minus a second or two.
Hide that logic in a true/false value procedure is_fresh_t, is_fresh_h, is_fresh_p
and use that instead of or in addition to the is_number tests.

Sample code for freshness:




Greetings,

I am typing over a fustercluck of gibberish to try to simplify my understanding. On the file I sent to you, after I connect to the ble, I can go to the Basic Outputs Page and see that all of the data has populated the labels. When I check a box and request data for DP or WB, why is it that the information is clearly visible on the output page but not available for the wet bulb or dew point calculations the first time the calculation is run? If this is a timing issue, why are there no further hiccups or glitches until I reboot? At one point, I tried loading the basic output data label information into the calculations (Temperature_F_Label vs Temp_ble) but to no avail.

I apologize for all of the "why, why, why's" but I still feel like I am missing some of the most basic concepts here. I see the data but the app doesn't - weird!

In AI2, things run only when they are asked to, by Event blocks.

Which Event blocks should be asking for those calculations to run and be displayed?

I vote for the BLE FloatsReceived event.

Oops, another "oops!" As my app is getting kind of close to where I want it to be, I am not comfortable posting a more finalized version, as it is probably impossible to get NDAs from everyone who reads this post. I am harvesting local data from WIFI and user data from a data entry pad. It seems that these other data sources will be wiped out every time the Bluetooth Floats event triggers and only ble events would be stored.

It looks like I should choose between calling one of three events for each data source. I.e. instead of "Call Save DryBulbTemp", I should "Call Save BLE_DryBulbTemp" in the Bluetooth floats block, "Call Save NWS_DryBulbTemp" in the Current CDX block, etc by using some "if" statements come output time. Conversely, I could create nine labels (3 for temperature, three for humidity [redundant], and three for air pressure) and call for each label in the appropriate block.

A final possibility that comes to my mind is to create one humdinger of a when/if statement that logically follows from top to bottom and doesn't allow events to trigger until they are reached in the sequence. I would simply incorporate all switch clicks and results in this long block. I think (again;) that this would prevent blocks without data (NaN) from running before their time but your opinion would be highly regarded.

Or maybe I should go back to stocking grocery shelves? Thank you for your patience with me as I attempt to wrap my head around the sequence of operations of my app and gain some commanding knowledge.

Some light reading for you

Greetings,

I have puzzled over this for a few days so I hope you might push some advice onto me. While you might have me place the ble call procedure blocks in the floats received block, there will be other sources of data. Please critique my thought here. Before, I didn't necessarily get data the first time for the wet bulb or dew point readings because, when the check boxes are checked, they immediately try to run the operations in "when checked." It was my belief that I could place all of my checkboxes into a single procedure that is called, only after all calculations have been performed and labels had been populated.

The program I attached runs in a basic form (from the opening page, backspace into the ble connect page. Once connected, I check all of the boxes. I get the temp, humidity, and pressure in metric or imperial but I get only zeros for the wet bulb and dew point outputs.

Is what I am doing fundamentally wrong and, if so, what may I do to prevent the checkbox functions from being run before the labels have been populated?
If you have addressed this already and I am just not getting it, kindly redirect me to the requested information. Thank you ever so much.

August_6_BU2_Help.aia (3.6 MB)