Hello, I am adding content dynamically from several lists defined in a variable, I have one variable with three products brand A and another one for brand B with two products, when I select brand A all three products appear in a table defined in a vertical arrangement, when I use “Screen1.BackPressed” block I go back to my original arrangement where all the brands are shown, when I select brand B which has just a couple of products my two brand B products appear in the table defined in the vertical arrangement plus the third one from brand A, is there anyone who could be so kind as to give me an idea as to how I should arrange my blocks to show just the two B products? Further down I will have several brands all with different number of products, I have experimented with my logic though I can’t get the desired behavior.
Maybe setting the table data to an empty list before to set the next data.
Get onto Google Sheets, and start a sheet with one row per product, with product in column 1 and brand in column 2.
Use the Spreadsheet component's filter block to request just the rows with the brand you want.
Thank you very much for your response, I have never used the SpreadSheet block before and I am just experimenting with it though since I do not know the logic behind it I still have not found a way to retrieve Data from my Google Spreadsheet, could you please let me know how this block should be used? I am attaching my blocks and a screen capture of my Spreadsheet.
You asked for row 1, because it is the only row with 'MARCA' in column 2.
What did you get back in Label1?
You might need an error event block for Spreadsheet1 to announce any errors, like lack of permission.
Sample app:
I have continued experimenting with the Spreadsheet.ReadWithExactFilter block and all I am getting is a default wrapper. I have also included the error event block but still I don’t get the desired response. Here are my blocks and a screen capture of my phone along with the spreadsheet.
I am also including screen captures of the app I am building showing the problem I am facing. As it can been in ScreenshotB.png all the car brands are shown (currently just the Alfa Romeo and the Isotta Fraschini are active) when selecting the Alfa brand three models are shown ScreenshotC.png if I select the Isotta brand after selecting the Alfa brand two Isotta models are shown plus the third Alfa model ScreenshotD.png whilst if I select the Isotta brand right after opening the app the two Alfa corresponding models are shown ScreenshotE.png.
I have experimented with different approaches though I still have not gotten the desired behavior. Hopefully if I can understand the Spreadsheet.ReadWithExactFilter block I will get my problem solved. I am including my .aia file in case this would help explain my blocks and logic.
Your sheet lacks all the columns needed to hold the descriptive attributes of each car, including year, photo, logo, cylinders, blurbs.
There's no point doing a read with exact filter if there's nothing to filter.
Here is an example of how to load a table and navigate it.
Hera are my blocks
Show what came back in Label1 .
Your rangedata came back with a table with one row and 4 columns (A2,B2,C2,D2).
I can see that by looking at the screen shot of Label1, where I see the JSON markup wrappers around lists, " " around pieces of text, and , between items of a row match up with how you had filled those 4 cells of your sheet.
If you are unfamiliar with how to read JSON, search the Web for "Introduction to JSON".
Regarding how to extract the proper items from that table and drop them into Labels, this code sequence could be used in the .GotRangeData event:
if length of list (rangeData) > 0 then
init local firstRow to select item 1 from rangeData
if length of list (firstRow) > 3 then
set LabelMarca.Text to select item 1 from firstRow
set LabelModelo.Text to select item 2 from firstRow
set LabelPotencia.Text to select item 3 from firstRow
set LabelDescripcion.Text to select item 4 from firstRow
Notice how I am testing length of list before I go to select items from each list.
I am following the technique of Defensive Programming, where you expect the unexpected.
If you have trouble getting data out of tables, see the introductory articles at
I have read an introduction to JSON and have understood the basis of it, also I have gone through the code you sent and I am assuming it should be in a Script for my SpreadSheet. When you said this sequence should be used in .GotRangeData event when it is run so it means it is called from the Spreadsheet, is this correct?
No.
No, I meant it to be in blocks like this:
The Labels are dummies I added because I have no idea where you want to show those 4 data.
I typed up that pseudocode because I was not in a position to open up your project and code blocks in it.
Thank you very much, now I know how to get my content from the spreadsheet, can I include images within the spreadsheet and retrieving them into the spreadsheet as well using the same process?
You can include URLS of where you loaded your images online to Drive and shared them in the spreadsheet, and use those URLs in Image components once they arrive.
Other Power Users have more advanced techniques.
Thank you very much for your guidance, I am experiencing an issue when retrieving data from my spreadsheet that is within the spreadsheet I have two sheets one is called Alfa and the other one is Isotta, when I fetch data from Alfa everything is ok though when I fetch data from Isotta what is returned is the data belonging to Alfa, could you please help me sort this out?
What is the purpose of theae blocks?
Usually you get the data and in the Got event you do the further processing...
Taifun
Those blocks are used when Data is fetched from a List, right now they are deactivated since I am experimenting with the Spreadsheet1 block
You check a variable named index (awful name) before deciding which sheet to read.
Where is that variable set, and what is its value at that time?
Show us the blocks from procedure marcaResultados
Taifun