Read with exact filter - works on columns, can it also work on rows?

You have to have started and connected to the MIT Companion app.

Running it on your phone is the fastest and easiest.

Hi
I am using the Companion App, but not the emulator.

Good.

Use the Connect->Companion option, and scan the code to complete the connection. Then you can set the phone down (I charge it) and apply Do Its in the Blocks Editor (after entering required inputs as needed)

Ok don't know what happened there, wasn't working before but is now. I'll have a go with it. Thanks again.

Hi again, I've got the following code and as you can see the Do It block on the a result of [9] which is correct, but when I try to display this using the volume text label i just get an empty string.

Any suggestions.

thanks
image

You executed the calculation of the Intersection using Do It, but you failed to apply Do It to the block that sets the value of that global variable?

Likewise for the next pair of blocks, that set the volume.Text value?

Is this what you mean? Or do you mean the currentOfferedToViewer and volumeText blocks need to have Do It done to them. If so I'm clicking on these 2 blocks getting the menu and clicking Do It but nothing happens. Is that because I already have Do It activated in a subsidiary block. If so how do I Undo Do It on those blocks?

thanks
image

Ok just tried hitting Do It for the volume text block and the correct result showed. will this happen automatically now each time it runs?

no
each time you have to click Do it again
Taifun

Do It is like a doctor hitting your knee with a rubber hammer to check your reflexes.

It's a one shot deal.

Hopefully, your knee works okay when you walk, without the doctor having to chase you down the street with his hammer.


Though it leaves no comment bubble behind, this is a shot of me applying a Do It to the set Label1.Text block in this code sequence. The running app reflects the effect of that in the Label.

OK, so thanks for your help with this, but this means that the Intersection block as above isn't working for me. It does produce the correct result if I do Do It to it but not otherwise, and obviously i can't keeping Do It -ing it in everyday use.

I'm going to try an approach of removing all the rows that don't meet the criteria for iscurrent (that is they are past a due date) - that is list 1 in the intersection block - from the spreadsheet then just searching the remainder - list 2 - for the relevant rows.

Any comment on how likely that is to work? Thanks!

I assume you will be working on an in-memory table copied from the spreadsheet, rather than trashing your data.

AI2 lists and tables are based on linked lists, so when you remove an item, every item past that index moves down to fill the empty index. This makes it necessary to loop from the end of the list down to 1 by -1 during a deletion pass.

Also, I missed something in your blocks:
ebdb1026273f27339efdbe48bb6574aa2a77cd82

You missed the point of the circled block.
It is explained here:

https://ai2.appinventor.mit.edu/reference/concepts/pholo.html

I left a tutorial copy of my intersection value procedure at

if you want to play with it or break it.

OK from the list block you noted 2 responses up I went to the associated link about functional blocks. From this it seemed the most useful approach for this situation would be the filter block. So I filtered the iscurrent block as below with the offerMadeToViewer block using blocks from the Intersection construct provided earlier.


This gives me a correct [9] response when I Do It to the subsequent currentOfferedToViewer variable.

Unfortunately as with previously using the Intersection block it's coming up just [] when I run or rerun the program.
Is this some sort of timing problem? If I used the clock to put in a delay before the calling the currentOfferedToViewer variable would that give the filter block above it time to run and come up with the [9] answer? Thanks again for your help.

Just to say, tried it with a clock delay, didn't work.

Any suggestions?

This thread is suffering from tunnel vision.

Each post explores a tiny bit of the problem, without access to the whole project and base database.

Could you post a link to the test data spreadsheet to allow exploration of all sheets?

An exported .aia file would also help.
If you need to guard your sheet access, then full block images of all events are needed, no code fragments, or remove your .json security file.

This does sound like a timing problem, or confusion between row ids and rows.

Hi aia and Google Sheets link attached.

FoodBanks.aia (762.3 KB)

Thanks again.

Which screen has the filtering for this thread?
(Nice documentation in the spreadsheet)

While I take the grand tour of your app, here are some bugs as I find them:


In the Offers sheet, column U shows them in DD/MM/yyyy format.
In Screen1, you issue a read column for column U and process it with

filtering the column data through a comparison against the current date in MMM d,yyyy format.
Because the formats don't match, the filter will always return empty.
I prefer yyyyMMdd for a date format, because its number comparisons match its temporal comparisons.

Also, that global row counter should be initialized at the top of the loop, for clean reusability.