How do you manipulate data to be displayed?

Greetings, Again

This app is slowly taking shape. It displays temperature, humidity, and atmospheric in labels 6, 7, and 15. I have two buttons to choose Imperial or Metric outputs. If Imperial is chosen, the data stays the same. If Metric is chosen, I want to display the temperature equivalent in Celsius and the Mercury in millimeters instead of inches. The calculations are simple enough but I am not clear about the best way to proceed, and how to use an If statement to select data based on the button pressed. I am not certain if I want parallel labels with the calculated data already populated or to calculate and place the data in a label. I do not grock how the set labels commands work in the currentCDX block. Does anyone with the knowledge also have the patience to explain what is happening in one of the setLabel.text blocks? I think I can master this puppy if I can just understand the data flow.

mmm, I'm not sure what is the problem...If you want two buttons, then get the original values in some variables (humidity, temperature...) and set the values for the same labels in the click event of each button.

In the ImperialButton.Click event set the labels to the received values (assuming you are receiving data in Imperial system) and in MetricButton.Click event set the labels to the metric values (transformed with the formulas).

an example:

Genius! Thank you. The joining of the calculation with the label was something I am not (yet) familiar with.

Oops, not so fast. You are initializing each variable separately and I am going them as a list, consequently, I do not know what to place in the empty block below because I cannot choose from the list (as far as I can see).

Take the values using the same dictionary blocks you are using in your shared blocks, set those values to variables and use the variables..

For exaple, with this you are getting temperature value, right? Then set that value to a variable nd use the variable to set it to the label or in the formula.

Thank you so much! It is so cool to actually watch a block I have assembled do something. Here is my solution, based on your advice.

1 Like