Using keywords inside a list as query argument

You can’t test Anvil tables in PyCharm. Well, you can, but first you need to create an Anvil app, configure a table, configure its uplink service, then create a script on your computer that connects to the app via uplink and works with the tables. It’s very easy, but it’s not where a beginner starts from.

You need to create an account, it takes 30 seconds and it’s free.

Then you need to go through some tutorials. That’s the best way to see how it works.

You are not the first trying to use Anvil without knowing Python. That’s what the free accounts and the tutorials are for.

Then feel free to ask anything, there are no stupid questions. But only if you first try it in Anvil and fail.

1 Like

Sorry, I misspelled your name Mr Stefano. I will be subscribing soon to Anvil and will try to be more circumspect when asking questions.

Thank you, just the same.

1 Like

Now I’m not sure what you mean by “subscribing.” To be clear, what we have in mind is to sign up for a free Anvil account. You don’t need a paid account to try this stuff.

And just to second what Stefano said:

1 Like

Thank you, I just signed up for free Anvil account, went thru the tutorial on creating a simple table (nane: fratbrods) with columns ‘lastname’, ‘firstname’, ‘age’ and ‘status’. After populating the table with enough rows, I tried your suggestion to search the table using a list. The variable user_spec contains (‘firsname’, ‘status’].

Here’s a simulation of your suggested approach:
user_spec = [‘Virgilio’, ‘retired’]

rows = [ row for row in app_tables.fratbrods.search()
if (row[“firstname”] == user_spec[0] and row[“status”] == user_spec[1]):
print(‘Entry found’)
else:
print(‘Not found’)
]

output below Anvil window

	SyntaxError: bad input
	at Form1, line 45

line 45 >> if (row[“firstname”] == user_spec[0] and row[“status”] == user_spec[1]):

Could you help me figure out what is the bad input in line 45? I don’t see any format error in the line. Can it be a logical issue?

Thank you.

1 Like

Please disregard. I found the formatting problem…it’s the closing ] that was at the wrong place.

1 Like