Error:expecting a colon, found ')' - Condition on null model date field

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
I'm receiving this Skuid error: Error:expecting a colon, found ')'. I've narrowed the issue down to the condition where one model date field is compared to the value of another model's date field. The error is only displayed when the 'value' model date field is null. This was not an error received before upgrading to Banzai. Any ideas?

You can see the very last condition in the SOQL is CheetahBMS__Out_Date__c <= ), I'm assuming that's the problem.


An error occurred while attempting to perform the following SOQL query: SELECT SUM(CheetahBMS__Quantity__c) AggQuantity,MAX(CheetahBMS__Product_Group__r.Name) maxCheetahBMSProductGroup,CheetahBMS__Product_Group__r.Id ProductAggId FROM CheetahBMS__Order_Line__c WHERE (CheetahBMS__Status__c != 'Checked In')AND(CheetahBMS__Status__c != 'Checked Out')AND(CheetahBMS__Product_Group__r.CheetahBMS__Consumable__c = false)AND((CheetahBMS__In_Date__c = null)OR(((CheetahBMS__Out_Date__c <= 2015-10-02T05:00:00.000+0000)AND(CheetahBMS__In_Date__c >= 2015-10-02T05:00:00.000+0000))OR((CheetahBMS__Out_Date__c >= 2015-10-02T05:00:00.000+0000)AND(CheetahBMS__Out_Date__c <= )))) GROUP BY CheetahBMS__Product_Group__r.Id Error:expecting a colon, found ')'
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Do you have a specific condition for that last statement?  If so,  I'm guessing you didn't select the "is Blank" option in the values section. 
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Not sure what you mean. The last condition is below. It has a value defined by a model. 

This error only pops up when the In Date field is blank on the Reservation model. 
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Hi Craig, this looks like a bug to me, I'll take a deeper look and let you know.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Confirmed, this is a bug with how Skuid handles null values on date fields in model merge conditions. I'll keep you updated.
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Thanks Ben. We use these conditions pretty frequently so please keep me updated. I don't believe we experienced this problem previously under older versions of Skuid if that helps at all.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Will do. I don't think it's going to make it in the patch that's going out today. But i'll try to get it fixed in the next one.
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Is there a way to temporarily hide the error with CSS? I can hide the .nx-error in my dev console and that works, but for some reason I can't find the right way hide it using CSS in my Skuid page. 
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
This should be fixed in Banzai Update 4. Which will be available on the www.skuidify.com/skuidreleases page either later today or tomorrow.
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Ben,

I'm running 7.20 and getting a different error but for the same scenario. 

1. An error occurred while attempting to perform the following SOQL query: SELECT SUM(CheetahBMS__Quantity__c) AggQuantity,MAX(CheetahBMS__Product_Group__r.Name) maxCheetahBMSProductGroup,CheetahBMS__Product_Group__r.Id ProductAggId FROM CheetahBMS__Order_Line__c WHERE (CheetahBMS__Location__c = '')AND(CheetahBMS__Status__c != 'Checked In')AND((CheetahBMS__Status__c != 'Checked Out')AND(CheetahBMS__Product_Group__r.CheetahBMS__Consumable__c = false))AND((CheetahBMS__In_Date__c = null)OR((((CheetahBMS__Out_Date__c <= 2015-02-06T06:00:00.000+0000)AND(CheetahBMS__In_Date__c >= 2015-02-06T06:00:00.000+0000))OR((CheetahBMS__Out_Date__c >= 2015-02-06T06:00:00.000+0000)AND(CheetahBMS__Out_Date__c <= null))))) GROUP BY CheetahBMS__Product_Group__r.Id Error:invalid operator

Not sure what the invalid operator is, I didn't see anything. Any ideas?
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Ok, it looks like the problem is here...

CheetahBMS__Out_Date__c <= null

SOQL doesn't like doing greater than / less than operators on null. What would your desired behavior be in this case? Would you want that condition to evaluate to true or false?
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
That seems like a viable workaround for now. However, I have not been able to make this work. I think there might be a bug with the datetime ui-only formula fields. 

I have a Ui only formula field with return type datetime. The formula is set to {{CheetahBMS__In_Date__c}}. It is not returning anything. When I change the return type to text, I get "2015-04-03T05:00:00.000+0000". I think that's a SF date, right? Or is it converting to JS and needs to be converted back?
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Sorry, I should have been more explicit. You'll have to use a Salesforce formula field. UI-Only fields aren't created until Skuid is running in your browser. These conditions are actually calculated in Apex. Unfortunately, you can't use merge syntax in model conditions.
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
I understand needing to use the Salesforce formula field for the model condition purpose, but I was still having an issue with the Ui only field displaying a datetime when being fed directly a salesforce datetime. 
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Ok, I get it now. I found a bug with this. I'll let you know when it's fixed.
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Awesome, thanks. By the way, the Salesforce formula field worked perfectly to remove the error.