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

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.

The Offers screen has the filtering

  • the iscurrent variable draws on the data in column x
  • the offerMadeToViewer draws from one of the columns H-O depending on which of these agencies is the current Viewer.
  • I'm focussing on an intersection between the above 2, to go into list currentOfferToViewer.

Do get back to me if you need more info than this. :slight_smile:

Another Screen1 bug, before I go to the Offers screen:




In Screen1 you issue a read range of sheet Offers, for range H1:O1
I assume the rangeData comes back as a list.
Your loop through the raangeData ends up with TinyDB tag offersUserList containing just the last item.
Each pass over the list replaces that tag/value with just the current item.

Maybe you wanted to just set that tag's value to rangeData to keep the entire list?

image

Offer1, or listOfOffers?

Sorry I meant the spreadsheet page Offers.
The AI2 screen I've been working on is list of Offers.

I'll read through your previous reply now and then get back to you.

OK so for the screen1 comment and removing the unnecessary loop the correction would look as below?
image

Yes, assuming you want the value of that tag to hold the entire returned list.

I'm bumping up against supper time here.
Sheet Offers has the names lined up across the sheet.
That's a problem if you want to scale this up or add and drop names.

I had mentioned earlier the idea of turning columns into rows using the equivalent of a JOIN table.

Is that idea still in play?

P.S. Before I break, here is an old, obsolete food trade logger based on a no longer available component.
I mention it for its table structure.

Ok I'll have a look at the Pizza Table approach and get back to you. Does
'supper' mean you're not back till after a night time break? I'm in NZ and It's lunchtime.
Yes I realise the column per foodbank provides scalaibility problems, but it's the only thing I've found that will work. The Receiver and Users Spreadsheet tabs shows a separate approaches to addressing this.