Second paremeter in lookup field

I have a lookup field on refCityId field, that gets some bool value from another table.
Now I need to filter it more by another parameter refAirportId from the same screen/table.

As long as only one parameter is supported, what is the simpliest/cleanest way to do it?
Creating the second lookup and function entity field?
Maybe I could use DataStructure parameter?
Something else?

A lookup is always defined on an entity field and looks up a value from another entity. It uses the current field’s value as a parameter. You cannot use any other field for that, only the current value.

I suppose your lookup field is not editable. In that case you can use the following solution:

  1. Define a relationship from the current entity to the lookup entity using refCityId field and the other field you want to use (so you will have 2 keys).
  2. Create an Aggregated Field based on this relationship. Use e.g. Min as an aggregation formula. Since the looked up value is unique anyway, it does not really matter.

This way you will get something like this as a sub-select in your main table’s SELECT statement:

SELECT 
   MIN(SomeValue) 
FROM
   TheOtherTable
WHERE
   refCityId = Original.refCityId 
   AND refOtherId = Original.refOtherId)