I have a rather complex collection where I add in a bunch of new columns...
It's not so bad basically
ClearCollect(CollectionName,AddColumns(ExistingTable as _existing,"My New Col1",somecode1,"My New Col2",somecode2))
What I want to do is perform calculations on these new columns...preferably when adding in the collection...at the time they are added. As the "somecode" for each column is pretty long, I really didn't want to repeat myself and I was hoping I could do this. But that doesn't appear to be the case...
If('My New Col1'="Mickey" && 'My New Col12'="Mouse","Awesome","Bummer")
Is there a way to do the above or must I either...
1) simply do it in another collection
2) re-type the whole code for the extra new column comparison - so this would seriously suffer some "DRY"
ClearCollect(CollectionName,AddColumns(ExistingTable as _existing,"My New Col1",somecode1,"My New Col2",somecode2,"GreatDay",If(somecode1 ="Mickey" and somecode2="Mouse","awesome","bummer")))
Here's the current full code, and my intent is that the new columns will have lengthy statements, so if that's the case it appears that I'll do another collection for simplicity's sake?
ClearCollect(
WorkloadSnapshot,
AddColumns(
Attendees As _Att,
"FlightArrivalDate",
LookUp(
EventFlightsArr,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
FlightArrivalDate
),
"FlightDepartDate",
LookUp(
EventFlightsDep,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
FlightDepartDate
),
"Hotel Bookings",
LookUp(
EventHotels,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
Bookings
),
"HotelMinCheckIn",
LookUp(
EventHotels,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
MinCheckIn
),
"HotelMaxCheckOut",
LookUp(
EventHotels,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
MaxCheckOut
),
"HotelNtsBooked",
LookUp(
EventHotels,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
NtsBooked
),
"HotelNtsExpected",
LookUp(
EventHotels,
Email = _Att.Email || If(!IsBlank(WorkerNo) && WorkerNo <> "Guest", WorkerNo = _Att.SourceId) || (Trim(Upper(LastName)) in _Att.'Last Name' && Trim(Upper(FirstName)) in _Att.'First Name'),
NtsExpected
)
)
);