PDA

View Full Version : Custom colours



VivienS
04-01-2015, 06:27 PM
Hi Stan. I've been customizing our grid (rack) colours for various reservation types with good success, but I've bumped up against one scenario that has me stumped. For cabin bookings of 5 or more days, we process the balance 30 days in advance of arrival, and I'd like those bookings to be a different colour on the grid. So I need to build two expressions, one for guaranteed cabin bookings of 5+ days, another for guaranteed, chosen (don't move) cabin bookings for 5+ days. This is what I've done, but it isn't working:

ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 24 AND Resv:Resv_Type = "Normal" AND Site:Attrib_Site_Type = "Cabin" AND ((Resv:Resv_Last_Date - Resv:Resv_First_Date) +1) >=5

---

ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 50 AND Resv:Resv_Type = "Normal" AND Resv:Resv_Dont_Move AND Site:Attrib_Site_Type = "Cabin" AND ((Resv:Resv_Last_Date - Resv:Resv_First_Date) +1) =>5

Where am I going wrong? http://crooked-stroke.org/smilies/personal/math.gif

sspielbusch
04-02-2015, 06:22 AM
The only obvious problem I see is in the 2nd one, "=>" should be ">=".

You don't need to test Resv_Dont_Move in the 2nd one because the status value already tells you it's don't-move.

I don't think it matters, but also try putting a space after the + in +1

Of coruse I'm assuming that you really do have a "Normal" for the resv type and "Cabin" for the Site Type so those match.

sspielbusch
04-02-2015, 06:26 AM
BTW, make sure this is above any others that might override it -- if it's showing one of your OTHER custom colors, then you need to move it up in the list of rules. And of course it needs to be in the same Color Scheme definition as your other custom colors, since only one can be selected for the Override reservation color scheme.

VivienS
04-02-2015, 03:49 PM
Thank you for your help, Stan, but it still isn't working. I fixed the >=, added a space before the 1, removed the "Don't Move" in the second expression, and moved those custom expressions to the very top of our custom colour rules. Yes, we have a "Normal" res type and a "Cabin" site type. I'm at a loss. Is it possible that, rather than as a site type, I should test for "Cabin" as rig type - seeing as the cabin is selected as the camping unit for those customers? Or should I test for both?

P.S.: When I calculate these expressions as they are, I get the "Operator/operand type mismatch" error, and it is the "(last - first) +1" part that causes the error. When I remove that, it returns a "false".

sspielbusch
04-02-2015, 04:42 PM
Getting an error like that when you calculate is certainly a problem (returning False is OK). The last - first expression may not work. There is a function for getting ResvNights(), try that instead.

Other than that, I can't really tell what the problem might be by just seeing the expressions. It could be something unrelated, like the order of rules, what you really have in your pick lists, etc.

VivienS
04-08-2015, 01:38 PM
Hello Stan. I should have posted before, but we did end up solving this a few days ago. Using the function did not work initially, until we realized that the context was missing. This is what the expressions now look like, and they're working:

ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 24 AND Resv:Resv_Type = "Normal" AND Site:Attrib_Site_Type = "Camping Cabin" AND ResvNights(ThisResv()) >= 5

ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 50 AND Resv:Resv_Type = "Normal" AND Site:Attrib_Site_Type = "Camping Cabin" AND ResvNights(ThisResv()) >= 5

Thanks again.