When the line of text is pulled from my Google Sheet into a text box, every cell comes over with [" "] at the start and end of the text. These characters are not in my Google Sheet. How can I stop them from transferring to the app?
The line of text is probably arriving as an AI2 list.
Post a Downloaded Blocks Image for confirmation.
There are ways to extract items from a list or format them.
See the introductory articles in
I like the JOIN WITH SEPARATOR block for easy formatting, and the SELECT LIST ITEM block for tweezers.
P.S. Remove eggs from the carton before cooking them.
This is what I am using to pull in lines of text at random whenever the button is pushed. The text comes over without a problem, but it adds the bracket and quotations at the beginning and end of each line of text.
You need many more variables, with purposeful names:
RawDownload
MottoTable
RandomRow
DatePart
MottoPart
Do not overwrite the same variable.
It muddies the water for debugging.
Rename your procedure to include its purpose.
Rename that MIT variable.
Use the Do It on everything to track intermediate results.
I appreciate your response!
I guess I need to ask from a VERY new app builder's point of view. Genuinely asking... does the name(s) of the blocks and variables matter, or is that just for my reference? Does that have a bearing on how the app functions? If so, I was not aware and will rebuild/rename with new labels.
As I said earlier, the app is working as expected by pulling over the text. The only issue I have is the added characters when it moves from my Google Sheet to the app. That being said, I might need a Kindergarten level of explanation if there are other blocks that might need to be added in, in order to get rid of those [" "] characters.
Should I be putting them into a LIST box instead of a TEXT box? If so, which blocks would I use to get the random pull to go into a LIST intead?
The names are critical to any one who reads the code.
Source code is for humans, machine code is for machines.
They convey to the reader the expectations of what to find in the variable or component, and relieve strain on the reader's memory as the app grows and more components and variables are added.
there are other blocks that might need to be added in
an extra select from list block.
Here is the introductory chapter on Lists from the free online book. Please do the reading.
http://www.appinventor.org/bookChapters/chapter19.pdf
A Table is a list of lists.
When you select an item from a table, you get a one dimensional list.
When you assign a list into a text holder (.Text, or a text block), AI2 automatically converts it to JSON format, adding the markup to help whoever gets the text to separate out the individual items in the future, if they want. See json.org for the formal specification.
You can put them into a variable, which can hold any type of data structure, and adapt to new types of values dynamically. Don't switch to display locations (.Text) until you have selected just what you want.
In your case, you need to select the row, then select the motto from the selected row.