Potential Bug with Model Conditions/ Grouping Logic?

Hello,

I am applying conditions to a model with fairly basic filter grouping logic added and am receiving SOQL query errors. I have tried various parenthesis, reordering, removing and re-adding conditions. This seems to be a very problematic bug. You can see if you compare the screenshot to the SOQL it is not reading the conditions in the correct order at all. Any suggestions would be greatly appreciated.

Thanks,
Sarah

Grouping Logic:
1 AND 2 AND 3 AND (4 OR 5) AND 6 AND (7 OR 8)

I have attached screenshots of the 8 conditions.

Here is the error message I am receiving:

1: An error occurred while attempting to perform the following SOQL query: SELECT Site__c,Site__r.Name,Expected_Capacity__c,Begin_Date__c,End_Date__c,Site__r.Address_Line_1__c,Program__c,Zone__c,Site__r.Id,Registration__r.Registration_ID_f__c,Registration__r.Site__c,Registration__r.Site__r.Name,Registration__r.Site__r.Id,Registration__r.Site__r.Status__c,Registration__c,Registration__r.Name,Registration__r.Registration_Status__c,Name,Operator__c,Id FROM Capacity_History__c WHERE (Registration__r.Site__r.Id in (‘aA64v000000D2ixCAC’,‘aA64v000000D2iyCAC’,‘aA64v000000D2izCAC’,‘aA64v000000D2j0CAC’,‘aA64v000000D2j1CAC’,‘aA64v000000D2j2CAC’,‘aA64v000000D2j3CAC’,‘aA64v000000D2j4CAC’,‘aA64v000000D2j5CAC’,‘aA64v000000D2j6CAC’,‘aA64v000000D2j7CAC’,‘aA64v000000D2j8CAC’,‘aA64v000000D2j9CAC’,‘aA64v000000D2jACAS’,‘aA64v000000D2jBCAS’,‘aA64v000000D2jCCAS’,‘aA64v000000D2jDCAS’,‘aA64v000000D2jECAS’,‘aA64v000000D2jFCAS’,‘aA64v000000D2jGCAS’))AND(Registration__r.Registration_Status__c != ‘0. Retired’)AND(Program__c = ‘Emergency Load Response Program’)AND((Operator__c = ‘I&M’)OR(Begin_Date__c <= N_MONTHS_AGO:12))AND(End_Date__c >= N_MONTHS_AGO:12)AND((End_Date__c = null)OR8) ORDER BY Program__c, Zone__c, Site__c, Begin_Date__c ASC,Id Error:expecting a right parentheses, found ‘OR8’

  1. Hi Sarah, thank you for the screenshot and error message. Could you please let us know the following:

    Which Skuid version is installed?

  2. This is a V2 page, correct?
  3. Did you check the page XML for any errors? ("View/Edit XML" at the bottom of the Page Composer)

Could you please copy the XML and paste it here? (please review this guide

  1. first)

Regards,

Luzie

Hi Luzie,

We are on version 12.1.3, and yes it is a V2 page. I looked at the portion of the XML for this model and everything aligns with what I set up, so it looks correct to me.

Here is the XML, I removed everything except the model that is not working and another model that is working that is exactly the same except for 3 added conditions and updated grouping logic (for comparison).

<skuid__page personalizationmode=“server” showsidebar=“false” showheader=“false” theme=“Lightning” title=“Configuration Aid Dashboard” uniqueId=“sk-1YNJ-1486” globalfeedbackenabled=“false”>























































































MONTH({{Begin_Date__c}})





















<skuid__header title=“Configuration Aid Dashboard for {{Agreement__r.Apttus__Related_Opportunity__r.Name}}” uniqueid=“sk-1hSM-615” styleSettingsVariant=“dde7ff71-a9f5-4958-ab02-f371019d61e8” separator=“true” model=“PLsWithSites”>




<skuid__buttonSet model=“OpportunitiesChart” uniqueid=“sk-tqh-3200”>

<skuid__buttonGroup uniqueId=“sk-1YNJ-2908”>

</skuid__buttonGroup>

</skuid__buttonSet>
</skuid__header>
<skuid__tabSet uniqueid=“ELRP/I&M HOP”>

<skuid__tabPanel name=“CPQ” uniqueId=“sk-1YcJ-18741”>

<skuid__grid uniqueid=“sk-1YcS-18956” flexDirection=“row” justifyContent=“flex-start” alignItems=“flex-start” columnGutter=“0” rowGutter=“0”>

								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQ" uniqueid="sk-289m-16506" mode="readonly" title="CPQ Full Detail" showSaveCancel="false" enableExport="true" allowSortingByColumn="false" pageSize="Infinity" adaptiveColumns="true">
										<fields>
											<field id="Program__c" uniqueId="sk-289m-17136" uniqueid="sk-289m-17216"/>
											<field id="Zone__c" uniqueId="sk-289m-17217" uniqueid="sk-289m-17297"/>
											<field id="Site__c" uniqueId="sk-3KAl-13785" uniqueid="sk-3KAl-13877"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-3K5i-12255" uniqueid="sk-3K5i-12335"/>
											<field id="Begin_Date__c" uniqueId="sk-289m-16893" uniqueid="sk-289m-16973"/>
											<field id="End_Date__c" uniqueId="sk-289m-16974" uniqueid="sk-289m-17054"/>
											<field id="Expected_Capacity__c" uniqueId="sk-289m-16812" uniqueid="sk-289m-16892" horizontalAlignment="right" summaries="sum,avg" defaultSummary="avg">
												<renderConditions logictype="and" onhidedatabehavior="keep"/>
												<enableConditions/>
											</field>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-289m-17298"/>
										<exportProperties useTableColumns="true" uniqueId="sk-28AE-20329"/>
										<renderConditions logictype="and"/>
										<styles>
											<spacing/>
										</styles>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
			<skuid__tabPanel name="ELRP/I&amp;M CPQ" uniqueId="sk-1DS-20463">
				<components>
					<skuid__grid uniqueid="sk-7D7-34936" flexDirection="row" justifyContent="flex-start" alignItems="flex-start" columnGutter="0" rowGutter="0">
						
							
								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQELRP" uniqueid="sk-Ces-47879" mode="readonly" title="ELRP/I&amp;M CPQ Full Detail" showSaveCancel="false" allowSortingByColumn="false" enableExport="true" pageSize="Infinity">
										<fields>
											<field id="Program__c" uniqueId="sk-Ces-48266" uniqueid="sk-Ces-48346"/>
											<field id="Zone__c" uniqueId="sk-Ces-49238" uniqueid="sk-Ces-49318"/>
											<field id="Site__c" uniqueId="sk-Ces-48995" uniqueid="sk-Ces-49075"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-Ces-49157" uniqueid="sk-Ces-49237"/>
											<field id="Begin_Date__c" uniqueId="sk-Ces-48671" uniqueid="sk-Ces-48751"/>
											<field id="End_Date__c" uniqueId="sk-Ces-48752" uniqueid="sk-Ces-48832"/>
											<field id="Expected_Capacity__c" uniqueId="sk-Ces-48914" uniqueid="sk-Ces-48994" horizontalAlignment="right"/>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-Ces-49319"/>
										<exportProperties useTableColumns="true" uniqueId="sk-Cey-54740"/>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
		</tabs>
		<renderConditions logictype="and"/>
		<styles>
			<spacing/>
		</styles>
	</skuid__tabSet>
</components>
<resources>
	<labels/>
	<css/>
	<javascript/>
	<actionsequences uniqueid="sk-1hWF-943"/>
</resources>
<styles>
	<styleitem type="background" bgtype="color">
		<styles>
			<styleitem property="background-color" value="#f9f9fa"/>
		</styles>
	</styleitem>
</styles>
<interactions/>
<background type="color" datasource="salesforce" source="url" size="cover" model="uiModel" url="https://images.unsplash.com/photo-1483444308400-fb9510501d23?ixlib=rb-0.3.5&amp;s=ee4397dfee173a9a3aa512400160218e&amp;auto=format&amp;fit=crop&amp;w=2253&amp;q=80" position="center center" color="#045668"/>

</skuid__page>

  1. Thanks, this was very helpful. When I paste the XML, it is invalid.

    How did you create the following condition, in the App Composer, or manually in the XML?

  2. I'm wondering if you are able to edit the page in the App Composer?
  3. If yes, can you delete the condition in the App Composer and create it again?

Because one of the issues that I found seems to be the ampersand in the model condition value:

In my test on a new page, when I created a condition in the App composer that checks if a field value is equal to “1&2”, then the XML looks like this, the ampersand is encoded automatically: value=“1&2”

But if I change the XML manually, and the ampersand is not encoded, this will cause an XML error: value=“1&2”

There seem to be other issues as well, I’ll keep investigating after I found out more about your setup based on your feedback :slight_smile:

Regards,

Luzie

Hi Luzie,

Thanks for taking a look.

  1. All conditions were created via the app composer. I created the page by starting with the sample Skuid Account dashboard page and removing most of the components (just to get a starting point with some colors and styling), but everything I added was done via the composer.
  2. Strangely, I got this version of the XML that I shared with you by deleting unneeded components from the app composer and saving, but now when I try to put it back in it is invalid.
  3. I just recreated the slimmed down XML for you via the app composer again, and I also removed and re-added the I&M condition at the end of the list via the composer/ readjusted the grouping logic. It is still creating it as value=“I&M”, but it is not saying invalid XML for me.

(posting the XML in a separate comment as it doesn’t fit here)

<skuid__page personalizationmode=“server” showsidebar=“false” showheader=“false” theme=“Lightning” title=“Configuration Aid Dashboard” uniqueId=“sk-1YNJ-1486” globalfeedbackenabled=“false”>























































































MONTH({{Begin_Date__c}})





















<skuid__header title=“Configuration Aid Dashboard for {{Agreement__r.Apttus__Related_Opportunity__r.Name}}” uniqueid=“sk-1hSM-615” styleSettingsVariant=“dde7ff71-a9f5-4958-ab02-f371019d61e8” separator=“true” model=“PLsWithSites”>




<skuid__buttonSet model=“OpportunitiesChart” uniqueid=“sk-tqh-3200”>

<skuid__buttonGroup uniqueId=“sk-1YNJ-2908”>

</skuid__buttonGroup>

</skuid__buttonSet>
</skuid__header>
<skuid__tabSet uniqueid=“ELRP/I&M HOP”>

<skuid__tabPanel name=“CPQ” uniqueId=“sk-1YcJ-18741”>

<skuid__grid uniqueid=“sk-1YcS-18956” flexDirection=“row” justifyContent=“flex-start” alignItems=“flex-start” columnGutter=“0” rowGutter=“0”>

								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQ" uniqueid="sk-289m-16506" mode="readonly" title="CPQ Full Detail" showSaveCancel="false" enableExport="true" allowSortingByColumn="false" pageSize="Infinity" adaptiveColumns="true">
										<fields>
											<field id="Program__c" uniqueId="sk-289m-17136" uniqueid="sk-289m-17216"/>
											<field id="Zone__c" uniqueId="sk-289m-17217" uniqueid="sk-289m-17297"/>
											<field id="Site__c" uniqueId="sk-3KAl-13785" uniqueid="sk-3KAl-13877"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-3K5i-12255" uniqueid="sk-3K5i-12335"/>
											<field id="Begin_Date__c" uniqueId="sk-289m-16893" uniqueid="sk-289m-16973"/>
											<field id="End_Date__c" uniqueId="sk-289m-16974" uniqueid="sk-289m-17054"/>
											<field id="Expected_Capacity__c" uniqueId="sk-289m-16812" uniqueid="sk-289m-16892" horizontalAlignment="right" summaries="sum,avg" defaultSummary="avg">
												<renderConditions logictype="and" onhidedatabehavior="keep"/>
												<enableConditions/>
											</field>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-289m-17298"/>
										<exportProperties useTableColumns="true" uniqueId="sk-28AE-20329"/>
										<renderConditions logictype="and"/>
										<styles>
											<spacing/>
										</styles>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
			<skuid__tabPanel name="ELRP/I&amp;M CPQ" uniqueId="sk-1DS-20463">
				<components>
					<skuid__grid uniqueid="sk-7D7-34936" flexDirection="row" justifyContent="flex-start" alignItems="flex-start" columnGutter="0" rowGutter="0">
						
							
								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQELRP" uniqueid="sk-Ces-47879" mode="readonly" title="ELRP/I&amp;M CPQ Full Detail" showSaveCancel="false" allowSortingByColumn="false" enableExport="true" pageSize="Infinity">
										<fields>
											<field id="Program__c" uniqueId="sk-Ces-48266" uniqueid="sk-Ces-48346"/>
											<field id="Zone__c" uniqueId="sk-Ces-49238" uniqueid="sk-Ces-49318"/>
											<field id="Site__c" uniqueId="sk-Ces-48995" uniqueid="sk-Ces-49075"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-Ces-49157" uniqueid="sk-Ces-49237"/>
											<field id="Begin_Date__c" uniqueId="sk-Ces-48671" uniqueid="sk-Ces-48751"/>
											<field id="End_Date__c" uniqueId="sk-Ces-48752" uniqueid="sk-Ces-48832"/>
											<field id="Expected_Capacity__c" uniqueId="sk-Ces-48914" uniqueid="sk-Ces-48994" horizontalAlignment="right"/>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-Ces-49319"/>
										<exportProperties useTableColumns="true" uniqueId="sk-Cey-54740"/>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
		</tabs>
		<renderConditions logictype="and"/>
		<styles>
			<spacing/>
		</styles>
	</skuid__tabSet>
</components>
<resources>
	<labels/>
	<css/>
	<javascript/>
	<actionsequences uniqueid="sk-1hWF-943"/>
</resources>
<styles>
	<styleitem type="background" bgtype="color">
		<styles>
			<styleitem property="background-color" value="#f9f9fa"/>
		</styles>
	</styleitem>
</styles>
<interactions/>
<background type="color" datasource="salesforce" source="url" size="cover" model="uiModel" url="https://images.unsplash.com/photo-1483444308400-fb9510501d23?ixlib=rb-0.3.5&amp;s=ee4397dfee173a9a3aa512400160218e&amp;auto=format&amp;fit=crop&amp;w=2253&amp;q=80" position="center center" color="#045668"/>

</skuid__page>

Hi Luzie - any updates on this? Thanks!

Hi there,

I’ve taken your updated XML and tried it in my own environment. I ran into the same issue with the &, but was able to fix that following Luzie’s recommendations.

Focusing on the “OR8” that shouldn’t be in the query: What happens when you remove that 8th condition from your model (and take out the reference to it in the logic)? I see you’ve got an OR in one of your other models, and in that same model too, and it’s not causing any issues, so I’m wondering if there’s something about that particular condition #8 that’s relevant to the problem. Specifically, in the original screenshot, condition 8 says End_Date__c needs to be null.

If removing the condition prevents the problem, then my next recommendation would be to try adding it back to see if that resolves the behavior.

Hi Mark,

It is happening regardless of which condition is the final one in the list. You can see above in my first example it was the ‘end date = null’ condition, but in my most recent comment the final condition is the ‘operator = I&M’, either way I am getting the errors (I have tried switching the order of the conditions many times including putting all the ANDs first, putting them in numerical order etc.).

Here is another example for you. I put the ‘starting month != 5’ condition at the end and adjusted grouping logic:

1: An error occurred while attempting to perform the following SOQL query: SELECT Registration__c,Registration__r.Name,Registration__r.Registration_Status__c,Program__c,Registration__r.Site__c,Registration__r.Site__r.Name,Registration__r.Site__r.Id,Operator__c,Begin_Date__c,End_Date__c,Expected_Capacity__c,Site__c,Site__r.Name,Site__r.Address_Line_1__c,Zone__c,Id FROM Capacity_History__c WHERE (Registration__r.Site__r.Id in (‘aA64v000000D2ixCAC’,‘aA64v000000D2iyCAC’,‘aA64v000000D2izCAC’,‘aA64v000000D2j0CAC’,‘aA64v000000D2j1CAC’,‘aA64v000000D2j2CAC’,‘aA64v000000D2j3CAC’,‘aA64v000000D2j4CAC’,‘aA64v000000D2j5CAC’,‘aA64v000000D2j6CAC’,‘aA64v000000D2j7CAC’,‘aA64v000000D2j8CAC’,‘aA64v000000D2j9CAC’,‘aA64v000000D2jACAS’,‘aA64v000000D2jBCAS’,‘aA64v000000D2jCCAS’,‘aA64v000000D2jDCAS’,‘aA64v000000D2jECAS’,‘aA64v000000D2jFCAS’,‘aA64v000000D2jGCAS’))AND(Registration__r.Registration_Status__c != ‘0. Retired’)AND((Program__c = ‘Emergency Load Response Program’)OR(Operator__c = ‘I&M’))AND(Begin_Date__c <= N_MONTHS_AGO:12)AND((End_Date__c >= N_MONTHS_AGO:12)OR(End_Date__c = null))AND8 ORDER BY Program__c, Zone__c, Site__c, Begin_Date__c,Id Error:unexpected token: AND8

(XML in the following comment - you can see that no matter what the final item is it is not reading it correctly)

<skuid__page personalizationmode=“server” showsidebar=“false” showheader=“false” theme=“Lightning” title=“Configuration Aid Dashboard” uniqueId=“sk-1YNJ-1486” globalfeedbackenabled=“false”>























































































MONTH({{Begin_Date__c}})





















<skuid__header title=“Configuration Aid Dashboard for {{Agreement__r.Apttus__Related_Opportunity__r.Name}}” uniqueid=“sk-1hSM-615” styleSettingsVariant=“dde7ff71-a9f5-4958-ab02-f371019d61e8” separator=“true” model=“PLsWithSites”>




<skuid__buttonSet model=“OpportunitiesChart” uniqueid=“sk-tqh-3200”>

<skuid__buttonGroup uniqueId=“sk-1YNJ-2908”>

</skuid__buttonGroup>

</skuid__buttonSet>
</skuid__header>
<skuid__tabSet uniqueid=“ELRP/I&M HOP”>

<skuid__tabPanel name=“CPQ” uniqueId=“sk-1YcJ-18741”>

<skuid__grid uniqueid=“sk-1YcS-18956” flexDirection=“row” justifyContent=“flex-start” alignItems=“flex-start” columnGutter=“0” rowGutter=“0”>

								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQ" uniqueid="sk-289m-16506" mode="readonly" title="CPQ Full Detail" showSaveCancel="false" enableExport="true" allowSortingByColumn="false" pageSize="Infinity" adaptiveColumns="true">
										<fields>
											<field id="Program__c" uniqueId="sk-289m-17136" uniqueid="sk-289m-17216"/>
											<field id="Zone__c" uniqueId="sk-289m-17217" uniqueid="sk-289m-17297"/>
											<field id="Site__c" uniqueId="sk-3KAl-13785" uniqueid="sk-3KAl-13877"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-3K5i-12255" uniqueid="sk-3K5i-12335"/>
											<field id="Begin_Date__c" uniqueId="sk-289m-16893" uniqueid="sk-289m-16973"/>
											<field id="End_Date__c" uniqueId="sk-289m-16974" uniqueid="sk-289m-17054"/>
											<field id="Expected_Capacity__c" uniqueId="sk-289m-16812" uniqueid="sk-289m-16892" horizontalAlignment="right" summaries="sum,avg" defaultSummary="avg">
												<renderConditions logictype="and" onhidedatabehavior="keep"/>
												<enableConditions/>
											</field>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-289m-17298"/>
										<exportProperties useTableColumns="true" uniqueId="sk-28AE-20329"/>
										<renderConditions logictype="and"/>
										<styles>
											<spacing/>
										</styles>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
			<skuid__tabPanel name="ELRP/I&amp;M CPQ" uniqueId="sk-1DS-20463">
				<components>
					<skuid__grid uniqueid="sk-7D7-34936" flexDirection="row" justifyContent="flex-start" alignItems="flex-start" columnGutter="0" rowGutter="0">
						
							
								<components>
									<skuid__table model="CapacityHistoriesWithSiteCPQELRP" uniqueid="sk-Ces-47879" mode="readonly" title="ELRP/I&amp;M CPQ Full Detail" showSaveCancel="false" allowSortingByColumn="false" enableExport="true" pageSize="Infinity">
										<fields>
											<field id="Program__c" uniqueId="sk-Ces-48266" uniqueid="sk-Ces-48346"/>
											<field id="Zone__c" uniqueId="sk-Ces-49238" uniqueid="sk-Ces-49318"/>
											<field id="Site__c" uniqueId="sk-Ces-48995" uniqueid="sk-Ces-49075"/>
											<field id="Site__r.Address_Line_1__c" uniqueId="sk-Ces-49157" uniqueid="sk-Ces-49237"/>
											<field id="Begin_Date__c" uniqueId="sk-Ces-48671" uniqueid="sk-Ces-48751"/>
											<field id="End_Date__c" uniqueId="sk-Ces-48752" uniqueid="sk-Ces-48832"/>
											<field id="Expected_Capacity__c" uniqueId="sk-Ces-48914" uniqueid="sk-Ces-48994" horizontalAlignment="right"/>
										</fields>
										<filtering enableSearch="false" instantSearch="false"/>
										<rowActions/>
										<massActions uniqueId="sk-Ces-49319"/>
										<exportProperties useTableColumns="true" uniqueId="sk-Cey-54740"/>
									</skuid__table>
								</components>
							
						
					</skuid__grid>
				</components>
			</skuid__tabPanel>
		</tabs>
		<renderConditions logictype="and"/>
		<styles>
			<spacing/>
		</styles>
	</skuid__tabSet>
</components>
<resources>
	<labels/>
	<css/>
	<javascript/>
	<actionsequences uniqueid="sk-1hWF-943"/>
</resources>
<styles>
	<styleitem type="background" bgtype="color">
		<styles>
			<styleitem property="background-color" value="#f9f9fa"/>
		</styles>
	</styleitem>
</styles>
<interactions/>
<background type="color" datasource="salesforce" source="url" size="cover" model="uiModel" url="https://images.unsplash.com/photo-1483444308400-fb9510501d23?ixlib=rb-0.3.5&amp;s=ee4397dfee173a9a3aa512400160218e&amp;auto=format&amp;fit=crop&amp;w=2253&amp;q=80" position="center center" color="#045668"/>

</skuid__page>

Hey @Smdrich - can you try upgrading to a more recent version of Skuid in sandbox and see if it resolves the issue?

It seems like maybe the ampersand in your condition value ‘I&M’ is causing the condition logic to be misread. We’re trying to reproduce the issue on 13.0.12 and so far have been unable.

Hi Anna - our AM had an SE look into this in our org and they confirmed it is a bug which they will look to fix in an upcoming release (issue persists without the ampersand filter, and is not resolved with an upgrade - both were tested).

Additionally, there have been a ton of enhancements to v2 between 12.1 and the Boston release, it’s definitely a lot more delightful to use and build in v2 in the newer versions!