Trying to do a calculated boolean based on date field in BAQ, get incorrect syntax near 'as'

I am creating a dashboard where i want to highlight customers with sofware support. (Or without. We shall see…).

Looks like if I apply a view-rule mydatefield < constant Tomorrow it works in classic:
image

image.

But when I try to deploy to a Kinetic App:
image

From this thread Publish Dashboard Rules - Publish its a known issue and the workaround is to add a calculated field at the BAQ level.

Here’s my attempt:


Syntax error…incorrect syntax near ‘as’

The query phrase looks ok:

select  
	[Customer].[Company] as [Customer_Company], 
	[Customer].[CustID] as [Customer_CustID], 
	[Customer].[CustNum] as [Customer_CustNum], 
	[Customer].[Name] as [Customer_Name], 
	[Customer].[City] as [Customer_City], 
	[Customer].[State] as [Customer_State], 
	[Customer].[Country] as [Customer_Country], 
	[Customer].[PhoneNum] as [Customer_PhoneNum], 
	[Customer].[EMailAddress] as [Customer_EMailAddress], 
	[Customer].[PrimecutNE_Owned_Count_c] as [Customer_PrimecutNE_Owned_Count_c], 
	[Customer].[PrimecutNE_Parked_Count_c] as [Customer_PrimecutNE_Parked_Count_c], 
	[Customer].[Software_Maintenance_Expires_c] as [Customer_Software_Maintenance_Expires_c], 
	[Customer].[ERP_System_c] as [Customer_ERP_System_c], 
	[Customer].[Primecut_Test_Account_c] as [Customer_Primecut_Test_Account_c], 
	(Customer.Software_Maintenance_Expires_c   <  Constants.Tomorrow) as [Calculated_primecutsupport] 

from Erp.Customer as [Customer]
order by Customer.Name

I tried adding square brackets also to my calculation: [Customer].[Software_Maintenance_Expires_c] < Constants.Tomorrow

no luck…

don’t add brackets. try CASE instead:

case
when Customer.Software_Maintenance_Expires_c < Constants.Tomorrow then 1 else 0 end

4 Likes

That’s it! thanks.

1 Like