Formatting String as a Number Failed

Hi, everyone. I am including a couple of screenshots involving my question. I am reading BLE data that reads to the ten-thousandths. I do not want this much specificity for the actual screen output so I tried to format the string as a number and limit the number of places to two but the system didn't like what I was doing.

Can someone suggest how I might accomplish what I am seeking? Thank you for any suggestions!

PS - I think the problem has something to do with the data showing up in [brackets]. I cannot find the source of these brackets in either the .ino sketch or the .ala file. I DID discover the almost magical "Replace All Text" block and I removed the brackets from my screen output. Any ideas on the source of the brackets will be greatly appreciated.


floatValues is a list, so you need to extract the first value out of it first, then call format as decimal number and then finally concatenate the %

Hi, again

I only think I know what you are saying. I did the following and the error message no longer shows, allowing the rest of the app to run but my data does not appear for these values.

Would you be so kind as to dissect what I have done or give me an example of what you are speaking of?

Hi Baran

Wouldn't it be easier to format the number to 2 decimal places in your Sketch (.ino) before sending to the App?

... it's a list of one I think

Baran - You have to process the number before adding the % symbol. Assuming (and we should not assume anything) floatValues is one value, for example, 3.14159265359

  1. format as a decimal number to 2 places = 3.14
  2. Join that result with the symbol, in so doing the number becomes text: 3.14%

Example:

OMG - nothing intuitive going on here, IMHO. One thing, Chris . . . I cannot find a text command that has a join feature such as the block I outlined in black. I included a screenshot of where I would expect to find that command.


It's the same block, after you right click on it and choose between external and internal sockets.

They work the same, just give you more control over the shape of the block cluster, whether you want a bushy tree for a deeply nested formula or a brick wall for a table.

It's style, not substance.

1 Like

Chris, I am so frustrated with my inability to comprehend what you are saying. Right clicking any join command does nothing to bring up sockets for me. Would you be so kind as to show me the steps necessary to transform a standard join command into that which you are using?

That's very strange.

Maybe you need more sockets

image

image

And with the blue gear you can drag more sockets:
image

If you have only one socket then the External Inputs and Inline Inputs will not appear.
image

3 Likes

Thank you @Ramon , I can go back to sleep now

1 Like

Text_Join

1 Like

Click the image to see it full size.

Ramon, ABG, Chris, et al.

Thank you so much for your patience with me. Ramon, the highlighted drop-down window finally did the trick. I actually created an image of that situation to send in without even noticing the fine detail of an added line in the drop-down box. I am definitely not the person you want to have on your team if you are playing a game of "what's different between these two pictures?"

I am, once again, overwhelmed by the generosity of knowledge and time all of you have bestowed (is that still a word?:slight_smile: on me as an old dog learning new tricks. Perhaps I will gain enough knowledge and insight to help others at some point in time.

1 Like

Ramon, ABG, Chris, et al.

Thank you so much for your patience with me. Ramon, the highlighted drop-down window finally did the trick. I actually created an image of that situation to send in without even noticing the fine detail of an added line in the drop-down box. I am definitely not the person you want to have on your team if you are playing a game of "what's different between these two pictures?"

I am, once again, overwhelmed by the generosity of knowledge and time all of you have bestowed (is that still a word?:: on me as an old dog learning new tricks. Perhaps I will gain enough knowledge and insight to help others at some point in time.

Please see my other reply. I can be SO very dense at times. Thank you, again, for your explainer video. I saw Ramon's highlighted screenshot first but your step-by-step mouse click example was wonderfully easy to follow. OK, now I know to use @ before user names, as well . . . the bot just informed me.

We do our best to help everyone. In this case, stream receive floats, there are some grey areas (dark grey) where we don't quit know how to get the List of values working as we expect, every time. I've started a conversation with the developer, Evan Patton, but he is an App Inventor VIP Guru and thus very busy.

Thanks, again. Your solution now has me displaying 2 decimal points. I will work on actually understanding what is happening in that block so I can replicate it.