Hi, the Bookings[Room] contain EnumLIST is there a way can can query into a list?
(SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<=[Checkin],[_THISROW].[Checkout]>[Checkin]))
-
SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<[Checkout],[_THISROW].[Checkout]>=[Checkout]))
-
SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]>=[Checkin],[_THISROW].[Checkout]<=[Checkout]))
-
SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<=[Checkin],[_THISROW].[Checkout]>=[Checkout]))
)
from the code above I got this as a result
instead I want out come as one list.
Please help
Hi @Tech_Service
Here:
https://community.appsheet.com/search?q=merge%20enumlist
Can you change the category of your post into “Questions” please ? It is more relevant.
5 Likes
Thank you ! This really help!
2 Likes
Thank you @Aurelien
I ended up using SPLIT() to each Select then Add them up later like this.
SPLIT(SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<=[Checkin],[_THISROW].[Checkout]>[Checkin])))+ SPLIT(SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<[Checkout],[_THISROW].[Checkout]>=[Checkout])))+ SPLIT(SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]>=[Checkin],[_THISROW].[Checkout]<=[Checkout])))+ SPLIT(SELECT(Bookings[Rooms],AND([_THISROW].[Checkin]<=[Checkin],[_THISROW].[Checkout]>=[Checkout])))
)
1 Like
Hi @Tech_Service
In your expression, that I allow myself to indent in order to add more readability:
SPLIT(
SELECT(Bookings[Rooms],
AND([_THISROW].[Checkin]<=[Checkin],
[_THISROW].[Checkout]>[Checkin]))
)
+ SPLIT(
SELECT(Bookings[Rooms],
AND([_THISROW].[Checkin]<[Checkout],
[_THISROW].[Checkout]>=[Checkout]))
)
+ SPLIT(
SELECT(Bookings[Rooms],
AND([_THISROW].[Checkin]>=[Checkin],
[_THISROW].[Checkout]<=[Checkout]))
)
+ SPLIT(
SELECT(Bookings[Rooms],
AND([_THISROW].[Checkin]<=[Checkin],
[_THISROW].[Checkout]>=[Checkout])))
)
There are various things that attract my attention. If you don’t mind, I would like to provide some corrections/improvements to it:
- According to the doc:
SPLIT() | AppSheet Help Center
delimiters are missing in your expression. This is curious you didn’t get any error message, as the delimiter is not optional.
- At this stage, and if you use only a SELECT expression inside of your SPLIT() ==> you can get rid of SPLIT part. SPLIT() is useful if you deal with some EnumList expression, for technical reasons (text separated with " , "), and used with CONCATENATE() expression as well.
- in your expression, all SELECT expressions are based on the same table and same column. You should use OR() expression inside one single SELECT statement.
So, your expression would become:
SELECT(Bookings[Rooms],
OR(
AND([_THISROW].[Checkin]<=[Checkin],
[_THISROW].[Checkout]>[Checkin]
),
AND([_THISROW].[Checkin]<[Checkout],
[_THISROW].[Checkout]>=[Checkout]
),
AND([_THISROW].[Checkin]>=[Checkin],
[_THISROW].[Checkout]<=[Checkout]
),
AND([_THISROW].[Checkin]<=[Checkin],
[_THISROW].[Checkout]>=[Checkout]
)
)
)
For reference:
3 Likes