A code format is required for the equation

welcome everybody
I'm working on creating an application to manage real estate. I have two tables
The first table (buildings) contains the following columns:
* identity
* building number
* the number of floors
* number of units
- Second Schedule (Apartments)
It contains the following columns:
* ID
* Apartment number
* Floor
* Building

What I need is for there to be suggested values โ€‹โ€‹for the (floor) cell in the apartments table based on the values โ€‹โ€‹you entered in the (number of floors) cell in the buildings table, so that if the number of floors is 5 in the building, the suggested values โ€‹โ€‹in the (floor) cell contain the choices following (1,2,3,4,5)

0 3 75
3 REPLIES 3

I don't know your particular use case, but there are situations where particular floors are not available in certain real estate situations.  For example:

  • a building might have office space on the first couple of floors and then apartments on the rest
  • A floor is closed due catastrophe, repair or remodeling
  • An entire floor purchased for Penthouse
  • Floor is fully occupied - no space for rent or buy
  • etc

For these situations, the particular available Floors need to be explicitly identified.  

Whether it is needed or not, I would take advantage of the possibility and provide in the Buildings Table an explicit dropdown to choose the "available Floors".  You can use this dropdown to derive the Building Floor count and then carry over the "available Floors" list into your Apartments Table.

I hope this helps!

Thanks a lot for your suggestion, but I want to implement this code

Ok.   There is not a way to dynamically assign a LIST of implicit values with some simple expression.  Instead you'll need to explicitly assign the desired LIST.  I would use the SWITCH() function for this ... like so:

SWITCH([Building].[Number of Floors],

1, {1},
2, {1 , 2},
3, {1 , 2 , 3},
4, {1 , 2 , 3 , 4},
5, {1 , 2 , 3 , 4 , 5}
...
{1 , 2 , 3 , 4 , 5, 6, 7, 8, 9, 10}
)

You would expand the above expression to account for "up to" the maximum number of floors you'd expect to encounter.

Another approach is to forego the use of a list and simply validate the input value.  If not valid, present a message that the "Floor must be less than or equal to [Building].[Number of Floors]"  where [Building].[Number of Floors] is replaced with the actual value.

Top Labels in this Space