The Lookup function uses the syntax lookup(...

The Lookup function uses the syntax

lookup([column],โ€œtableโ€,โ€œcolumnโ€,โ€œcolumnโ€)

Shouldnโ€™t it be:

lookup([column],โ€œtableโ€,[column],[column])

to fit with all (most?) other syntax?

Just seemed odd to me, very hard to remember, I have to look it up every time.

1 7 673
7 REPLIES 7

You are probably looking forโ€ฆ LOOKUP([_THISROW].[column],table,column,column)

Why do you say that? Wouldnโ€™t any column reference as the first argument be parsed on a row-by-row basis anyways?

I was more-so just pointing out that the 3rd and 4th column arguments are put into quotes instead of brackets. Why is that?

You need to say [_THISROW].[Column] if you are looking the value from outside of your source table. Itโ€™s the same than with SELECT expression. You donโ€™t need to use quotes if you donโ€™t use any special column names like โ€œDateโ€ etc. so the parser will read them as column names, not as an expression.

LOOKUP() is effectively a preprocessor macro around ANY(SELECT()).

New to AppSheet and not sure what the other responses are talking about but your question helped me today. Thank you for posting it. I was using the typical column syntax and got an error about not having enough arguments. As soon as I switched to โ€œโ€ syntax you point out the expression worked as expected. I cannot thank you enough!

Iโ€™m glad my newbie mistakes from 2 years ago have helped you out.

The key here is at [column] returns the value from that column. The lookup expressions is needing column names for the 3rd and 4th arguments, not values from a column.

For reference:

Top Labels in this Space